# Copyright (c) 2015 by Michael Zahniser
#
# Endless Sky is free software: you can redistribute it and/or modify it under the
# terms of the GNU General Public License as published by the Free Software
# Foundation, either version 3 of the License, or (at your option) any later version.
#
# Endless Sky is distributed in the hope that it will be useful, but WITHOUT ANY
# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
# PARTICULAR PURPOSE.  See the GNU General Public License for more details.

mission "First Contact: Hai"
	landing
	source
		attributes "hai"
	on offer
		conversation
			branch unfettered
				has "First Contact: Unfettered: offered"
			`This planet is populated by an alien species that resemble giant, intelligent squirrels. However, the most surprising aspect of the spaceport is not the aliens, but the fact that human merchants and other civilians are walking among them and are clearly at home here. Would you like to find someone who can tell you what is going on here?`
			choice
				`	(Sure.)`
				`	(Not right now.)`
					defer
			
			`	You walk up to a human merchant who is busy haggling with one of the aliens. They interrupt their conversation when they see you approaching, and the human gestures for you to join them. "You look totally lost," he says. "First time down the rabbit hole?"`
			`	You nod. The alien reaches out a paw to shake hands with you. "Welcome to Hai space," it says. "We are people of peace, and you are free to visit us or even live among us. Our worlds provide enough bounty for all."`
				goto next
			
			label unfettered
			`The Hai here seem more friendly and approachable than those you met earlier. Even more surprising though is the fact that human merchants and other civilians are walking among them and are clearly at home here. Would you like to find someone who can tell you what is going on here?`
			choice
				`	(Sure.)`
				`	(Not right now.)`
					defer
			
			`	You walk up to a human merchant who is busy haggling with one of the Hai. They interrupt their conversation when they see you approaching, and the human gestures for you to join them. "You look lost," he says. "First time down the rabbit hole?"`
			`	"No, I've actually met with the Hai up north," you respond. The merchant looks slightly concerned with this, but the Hai only seems to sigh.`
			`	"Ah, you have met our wayward sisters and brothers. I hope that they did not cause you too much trouble, for they are misled in their ways," it says. "Welcome to Hai space. Unlike those that you met before, the rest of us are a people of peace, and you are free to visit us or even live among us. Our worlds provide enough bounty for all."`
			
			label next
			`	You glance quickly at the human merchant to see his expression, wondering if these aliens can indeed be so benign, but his expression is calm and untroubled. "It's true," he says, "look around you. These buildings have stood for thousands of years. Hai society is so advanced, they need almost no resources to maintain it."`
			choice
				`	"Why do you allow humans to settle here?"`
				`	"What do you ask for in return for letting humans settle here?"`
			
			`	"Humans are a young species," the Hai says, "full of energy, full of new ideas. And the Hai are old, and everything we do is what we have done before. When humans go on vacation, they travel to a world with perfect weather, sunny every day. When Hai go on vacation, we visit the stormiest world, to find unpredictability and change. Humans are so strange, that to speak with a human is like a small vacation." It smiles, and you catch a glimpse of its massive incisors. Based on your knowledge of xenobiology you would guess that the Hai are herbivores, but you can't be certain.`
			branch hostile
				has "First Contact: Unfettered: offered"
			choice
				`	"So I'm allowed to travel throughout your territory if I want?"`
					goto travel
				`	"How come people back in human space don't know that you are here?"`
					goto human
			
			label hostile
			choice
				`	"If your people are peaceful then why are the Hai from the north so hostile?"`
					goto why
				`	"How come people back in human space don't know that you are here?"`
			
			label human
			`	The human merchant laughs. "Probably because most of us came here to escape from the chaos and fighting in human space. The last thing we want is for it to follow us here. Not that I'm saying you can't tell anyone about the wormhole, but if I were you I wouldn't go spreading the news too widely either. And take a look around Hai space before you leave; you'll find that we could learn a lot from them."`
			branch question
				has "First Contact: Unfettered: offered"
			`	"So I can travel anywhere I want in your territory?" you ask the Hai.`
			
			label travel
			`	"Yes," it says, "but be careful. The north is the territory of some renegade Hai who are misled in their ways: bandits and pirates, living off what they steal from the rest of us. If you travel among them, you will not be safe."`
				goto end
			
			label question
			`	"If your people are peaceful then why are the Hai from the north so hostile?" you ask the Hai.`
			
			label why
			`	"I am young, and the origins of our 'Unfettered' brethren are before my time," it responds. "If you want to know more, it might be wise to find someone much older than myself to ask."`
			
			label end
			`	You talk for a while longer, but do not gain much additional information except that several of their worlds are willing to sell Hai technology even to human beings. You thank them both for stopping to talk with you, and the Hai responds, "We are always glad to welcome new friends. May peace dwell in your heart until we meet again."`
				decline
	on decline
		log "Factions" "Hai" `The Hai are a species of giant, intelligent rodents, who live to the north of human space. They allow any humans who discover their territory to live alongside them, and to trade with them and purchase their technology.`

mission "Discovered Hai Space"
	landing
	invisible
	source
		government "Hai"
	on offer
		event "label hai space"
		fail

event "label hai space"
	galaxy "label hai"
		sprite "label/hai"



mission "Assisting Hai"
	assisting
	repeat
	to offer
		random < 27
	source
		government "Hai"
		not attributes "automaton"
	on offer
		payment 30000
		conversation
			`Knowing you risked your life to save the <origin>, the captain gives you <payment>.`
				decline
	destination "Hai-home"



mission "First Contact: Unfettered"
	landing
	source
		attributes "unfettered"
	on offer
		conversation
			branch hai
				has "First Contact: Hai: offered"
				
			`This planet is populated by a hostile alien species that resembles giant, intelligent squirrels. Do you want to approach one of them?`
			choice
				`	(Sure.)`
				`	(Not now, it's too risky.)`
					defer
			`	You catch the eye of one of the alien dock workers and it walks over. "Ah," it says, "the monkey is curious. The monkey has never been face to face with a true Hai before?"`
			choice
				`	"Hai? Is that what you call yourselves?"`
					goto name
				`	"What do you mean, 'true Hai'?"`
					goto true
				`	"Why did you shoot at me? Are you at war?"`
					goto war

			label hai
			`The Hai here appear to be at war with the rest of their species. Do you want to approach one of them and ask why?`
			choice
				`	(Sure.)`
				`	(Not now, it's too risky.)`
					defer
			`	You catch the eye of one of the Hai dock workers and it walks over. "Ah," it says, "the monkey is curious. The monkey has never been face to face with a true Hai before?"`
			choice
				`	"No, I've encountered many of your brethren south of here."`
					goto brethren
				`	"What do you mean, 'true Hai'?"`
					goto true
				`	"Why are you at war with everyone else?"`
					goto everyone
			
			label brethren
			`	It hisses. "They are not true Hai. We are Hai. The unaltered. We were masters of a hundred worlds before human monkeys had learned the use of thumbs."`
				goto masters
			
			label true
			`	"It means that we are unaltered, Hai as Hai were first born to be. Hai the conquerors. We were masters of a hundred worlds before human monkeys had learned the use of thumbs."`
				goto masters
			
			label name
			`	"We are Hai. Hai the conquerors. We were masters of a hundred worlds before human monkeys had learned the use of thumbs."`
				goto masters
			
			label war
			`	"We fight to defend ourselves from extinction," it says.`
			`	"Extinction?" you ask. "Do you mean that there are no other Hai?"`
			`	"We are all that is left of the original Hai," it says. "Unaltered. The conquerors. We were masters of a hundred worlds before human monkeys had learned the use of thumbs."`
				goto masters
			
			label everyone
			`	"We fight to defend ourselves from extinction," it says.`
			`	"Extinction'" you ask. "Do you mean that you are not the same species as the other Hai?"`
			`	"Indeed," it says. "We are all that is left of the original Hai. Unaltered. The conquerors. We were masters of a hundred worlds before human monkeys had learned the use of thumbs."`
				goto masters
			
			label masters
			choice
				`	"Where was your territory? Why have I never heard of you before?"`
				`	"What do you mean, the Hai were altered?"`
			
			`	"This is our story," it says. "Once, many worlds beyond wormhole were ours. Once, hundred thousand years now gone. We needed more worlds. A species that does not expand becomes like brackish water, like stunted tree. But dragonfolk in the south had created hyperdrive, and human monkeys had begun banging rocks together in what the Drak said was very intelligent fashion. So we were forbidden from taking more worlds."`
			`	"'Dragonfolk?'" you ask. "I've never heard of them."`
			`	"Sheragi," it says, "they are extinct. Only their dumb ancestors survive, just as monkeys will outlast the thinking humans."`
			`	"How were you altered?" you ask.`
			`	It says, "We Hai fought Sheragi and took worlds that Drak said belonged to them, worlds that Sheragi had not yet even discovered. Drak retaliated. On all Hai worlds, Drak ships appeared in orbit. Sickness swept each planet: quick fever, strange feeling of frailness, like you are brittle bones with mouth full of dirt. Victims left alive, but all ambition gone, no desire but to die of comfortable old age."`
			choice
				`	"Did you try to resist the Drak?"`
					goto resist
				`	"How do you know this, if it happened a hundred thousand years ago?"`
					goto know
			
			label resist
			`	"Silly monkey," it says, "none can resist. They are strong. Their will prevails. And their will is for the galaxy to be a zoo, little remnants of each species all in separate cages. For now they let humans run free so humans will grow in knowledge, but soon they will fashion a cage for humans too."`
				goto help
			
			label know
			`	"All Hai know. The story is passed down. Others tell an altered version, where the way of peace was choice and not an inflicted wound, but some in each generation learn truth, and join us here."`
				goto help
			
			label help
			choice
				`	"That is a frightening story. Thank you for taking the time to speak with me."`
					decline
				`	"Is there anything I can do to help you?"`
			
			`	"If you are ever willing to sell us a jump drive," it says, "we will richly reward you. And if you discover the secret of how we can construct our own jump drives and escape from this prison, bring it to us and you will live as a god among us."`
			choice
				`	"I'm sorry, I don't know the secret of the jump drive. No human being does."`
				`	"If I ever have an extra jump drive to sell, I will bring it to you."`
					goto sell
			`	"Then leave us alone," it says, and it walks off.`
				decline
			
			label sell
			`	"Bring us a jump drive," it says, "and we will count you among our friends. Bring us more, and we may even consider you worthy of a share of the plunder, when we take back what is ours."`
				decline
	
	on decline
		log "Factions" "Unfettered Hai" `The "Unfettered" are a faction within the Hai species who are not as peaceful as the rest, and are normally not friendly toward humans. They claim that long ago the Drak altered the Hai to make them docile and peaceful, and that the Unfettered are descendants of those Hai who avoided undergoing that alteration. They are seeking jump drives so that they can escape the "prison" they are now stuck in: a few deteriorating worlds on the far northern edge of Hai space.`
		log "Factions" "Sheragi" `The Unfettered Hai say that a dragon-like species called the "Sheragi" who are long extinct used to live in human space, back when much of what is now human territory was occupied by the Hai.`



mission "Ask the Hai about the Unfettered"
	landing
	source
		attributes "hai"
	to offer
		has "First Contact: Hai: offered"
		has "First Contact: Unfettered: offered"
	on offer
		conversation
			`The Unfettered Hai say that they are the "true Hai," and seem to think that the other Hai are oppressing them, but another Hai that you spoke to said that the Unfettered Hai are simply misled. Would you like to look for someone here who can tell you more of the story?`
			choice
				`	(Yes.)`
				`	(No.)`
					decline
			`	You find an elderly-looking Hai who is sitting on a bench watching the starships land and take off. As you approach, he says, "Hello human."`
			choice
				`	"Hello. I've met some of the Unfettered Hai. What can you tell me about them?"`
				`	"Hello. Can you tell me why you are at war with the other Hai who live to the north?"`
					goto war
			`	He says, "Ah, our wayward sisters and brothers to the north. You have surely seen what our society is like: safe, stable, predictable, deliberate. It suits most of us well. But there are those..."`
				goto raids
			label war
			`	He says, "I would not call it war. We launch no raids on them. We only defend when they attack. And, we supply them with food and other things needful for life. They are not our enemies, they are just those who do not fit in. You have surely seen what our society is like: safe, stable, predictable, deliberate. It suits most of us well. But there are those..."`
			label raids
			`	He pauses. "No, I am telling this unfairly. I will start again. Hundreds of years ago, when I was young, our territory was raided by aliens from the east, who came in massive warships and plundered our worlds. In those days there were some Hai who were brave enough to risk their lives to defend us. The raids lasted for decades, then abruptly stopped.`
			`	"Most of those who had fought the invaders were glad to return to ordinary life, but there were some for whom life now seemed bland and meaningless without the excitement and chaos of war. They started colonies in the systems to the north, and fought amongst themselves, and mismanaged the land, and grew in numbers. And now their worlds cannot feed them all, and they invade us and tell stories to put blame on us for their failures."`
			choice
				`	"Shouldn't they be treated with gratitude for defending you against the raiders?"`
				`	"They said the Drak altered the Hai to make them less aggressive. Is that true?"`
					goto drak
				`	"That's all I wanted to know. Thanks."`
					decline
			`	"They were, and still should be. There will always be times when our society needs them. Only at this time, the need is not so great. There is no new frontier for them to explore, no worthy challenges for them to face. And we fear what would happen if they ventured south and gained access to the wormhole, so we must force them to stay where they are."`
			choice
				`	"They said the Drak altered the Hai to make them less aggressive. Is that true?"`
				`	"That's all I wanted to know. Thanks."`
					decline
			label drak
			`	"No," he says, "it is a story they invented, that the Hai were destined to be masters of the galaxy but the Drak and the Quarg prevented us. The story is not true. Our civilization beyond the wormhole was brought down by infighting and unwise governance. Amid the wreckage we studied and thought and argued and came to believe that we could rule a small territory with stability and peace, or hold more worlds but with constant turmoil. We chose stability, and relinquished those worlds."`
			choice
				`	"So you don't think the Drak are keeping us all in cages?"`
				`	"That's all I wanted to know. Thanks."`
					decline
			`	He thinks about the question for a while, then says, "Sometimes we make a fire for cooking food. The fire consumes much wood, and the flames are tall, too wild and hot to cook food well. Then the wood becomes coals that burn slowly with no flames or smoke, and when you gather them they are good for roasting meat or even baking bread. Perhaps each species must consume many worlds and many resources before learning to burn slowly, and the wisdom of the Drak is to allow them to do so. But when they find balance, as we did, they no longer need so much space."`
			`	You thank him for taking time to speak with you, and say goodbye.`
				decline



mission "Unfettered Jump Drive 1"
	name "More Jump Drives"
	minor
	description "The Unfettered Hai have promised you rich rewards if you bring them more jump drives."
	landing
	to offer
		has "First Contact: Unfettered: offered"
		not "Wanderers: Jump Drive Source: active"
	to fail
		has "event: wanderers: unfettered invasion starts"
	to complete
		has "Unfettered Jump Drive 2: offered"
	source
		attributes "unfettered"
	on offer
		conversation
			`The Unfettered have clearly noticed that you have a jump drive installed; a large crowd of them has gathered around your ship. Do you want to talk with them, and perhaps arrange a sale of your jump drive?`
			choice
				`	(No.)`
					defer
				`	(Yes.)`
			`	As soon as you approach the crowd, one of them steps forward and says, "One million credits, and the friendship of the true Hai people. This is our offer, for the jump drive."`
			choice
				`	"Sure, I will accept that deal."`
					goto end
				`	"Can you offer me more than that?"`
					goto more
				`	"How will my ship leave here without my jump drive?"`
			
			`	"We will give you a hyperdrive in its place," it says, "and you will be counted as our friend, so you will not need to leave here quickly, or under threat of violence." You can't help but wonder if they will try to take your ship by force if you do not agree to the deal.`
			choice
				`	"Okay, I accept your generous offer."`
					goto end
				`	"Sorry, but if I give you this jump drive, I will lose my ability to capture more of them. Be patient, and I will bring you several of them when I am able."`
					goto refuse
			
			label refuse
			`	It ponders this for a while, and says, "Very well. Our offer stands, whenever you choose to return." They allow you to return to your ship peacefully.`
				defer
			
			label more
			`	"Do not underestimate the value of our friendship," it says. "Soon we will become powerful once more, with many fruitful worlds under our control, and when that day comes you will benefit greatly from being our ally."`
			choice
				`	"Okay, as long as you give me a hyperdrive to take its place, I'll give you my jump drive."`
					goto end
				`	"Sorry, but if I give you this jump drive, I will lose my ability to capture more of them. Be patient, and I will bring you several of them when I am able."`
					goto refuse
			
			label end
			`	The Unfettered engineers quickly and carefully remove your jump drive and replace it with an ordinary hyperdrive. You sincerely hope that you are not making a mistake by giving them this new technology. "Remember," one of them says as it hands you your payment, "when you acquire more jump drives, return here with them and we will give you further rewards. Until then, may fortune favor you, human friend."`
				accept
	
	on accept
		outfit "Jump Drive" -1
		outfit "Hyperdrive" 1
		payment 1000000
		"reputation: Hai (Unfettered)" >?= 10



mission "Unfettered Jump Drive 2"
	name "More Jump Drives"
	minor
	description "The Unfettered Hai have promised you rich rewards, and more information about their plans, if you bring them more jump drives."
	landing
	to offer
		has "Unfettered Jump Drive 1: offered"
		not "Wanderers: Jump Drive Source: active"
	to fail
		has "event: wanderers: unfettered invasion starts"
	to complete
		has "Unfettered Jump Drive 3: offered"
	source
		attributes "unfettered"
	on offer
		conversation
			`As before, when you land on this Unfettered world with a jump drive, a large crowd gathers around your ship. Clearly they are hoping that once again you will arrange a sale. Do you want to bargain with them?`
			choice
				`	(No.)`
					defer
				`	(Yes.)`
			`	When you approach the crowd, one of them says, "Greetings, human friend. We have made you known to all our brothers and sisters as one of the few creatures who have chosen to help the true Hai to gain their freedom. If you give us another jump drive, we will pay you another million credits, and make you one of our emissaries to collect the payments with which our frail brothers seek to buy peace. Will you accept this exchange?"`
			choice
				`	"Sorry, I need this jump drive right now, but I will come back later and sell it to you."`
					defer
				`	"Yes, I will sell you my jump drive."`
			`	Once again, they swap your jump drive for a hyperdrive, and pay you far more than you could sell a jump drive for anywhere else. "We will tell the other true Hai to offer you jobs in our job boards," they tell you, "and remember that we need still more jump drives."`
			choice
				`	"Then I will find more, and bring them to you."`
					accept
				`	"Can you tell me what you are using them for?"`
			`	"Not yet. If you further prove your friendship, perhaps we will." You assure them that you will continue to do your best to assist them.`
				accept
	
	on accept
		outfit "Jump Drive" -1
		outfit "Hyperdrive" 1
		payment 1000000
		"reputation: Hai (Unfettered)" >?= 20
		fail "Unfettered Jump Drive 1"



mission "Unfettered Jump Drive 3"
	name "More Jump Drives"
	minor
	description "If you find more jump drives, you can sell them to the Unfettered Hai for considerably more money than they are worth elsewhere."
	landing
	to offer
		has "Unfettered Jump Drive 2: offered"
		not "Wanderers: Jump Drive Source: active"
	to fail
		has "event: wanderers: unfettered invasion starts"
	to complete
		has "Unfettered Jump Drive 4: offered"
	source
		attributes "unfettered"
	on offer
		conversation
			`You have another jump drive, and the Unfettered will certainly be willing to pay you well for it. They also hinted that they might be willing to give you more information about what they plan to use the jump drives for. Do you want to sell them another drive?`
			choice
				`	(No.)`
					defer
				`	(Yes.)`
			`	You meet up with some local Unfettered leaders, and they again pay you a million credits and arrange for your jump drive to be swapped out of your ship. "If you bring more, we will continue to pay you," they say.`
			choice
				`	"Can you tell me what you are using the jump drives for?"`
				`	"Thank you, I will certainly bring more of them when I am able."`
					accept
			`	After a brief and hushed discussion in their own language, one of the leaders says, "You have proven your worth, so we will share our secret. The Hai once owned many worlds on the galactic fringe, a territory we can only visit using the jump drive. Those worlds are fruitful and nearly uninhabited. We will reclaim them as our own, and there will be food there to feed the Unfettered for many thousands of years to come."`
			branch know
				has "First Contact: Wanderer: offered"
			choice
				`	"Is there any other way I can help you to reclaim those worlds?"`
					goto help
				`	"'Nearly uninhabited?' You mean another species inhabits some of those worlds now?"`
					goto wanderers
			
			label know
			`	You suspect that they are talking about the territory that is now inhabited by the Wanderers.`
			choice
				`	"Are you at war with the Wanderers? Can I help you to reclaim your territory?"`
					goto help
				`	"What are you going to do to the species that owns those worlds right now?"`
					goto wanderers
			
			label help
			`	"Your help may indeed be beneficial to us," says the leader. "I will tell the others to contact you if they have any particular missions you can undertake."`
			choice
				`	"I look forward to hearing from them."`
					accept
				`	"What do you plan to do to the species that inhabits those worlds now?"`
			
			label wanderers
			`	"Those worlds are now held by a species of scavengers, who feast on the ruin of proud civilizations. Our scouts tell us that these carrion-feeders have wiped away nearly every Hai artifact, melting down our cities to make metal for their ships and factories, and hiding the scars of our wars beneath newly planted forests. They are an old and strong species, but few in number, and those worlds are ours by right."`
			`	You try to press them for more information, but they tell you nothing useful, aside from promising you that they will seek out your help when it is time to reclaim their territory.`
				accept
	
	on accept
		outfit "Jump Drive" -1
		outfit "Hyperdrive" 1
		payment 1000000
		"reputation: Hai (Unfettered)" >?= 30
		fail "Unfettered Jump Drive 2"



mission "Unfettered Jump Drive 4"
	repeat
	minor
	to offer
		has "Unfettered Jump Drive 3: offered"
		not "Wanderers: Jump Drive Source: active"
	to fail
		has "event: wanderers: unfettered invasion starts"
	to complete
		never
	source
		attributes "unfettered"
	on offer
		conversation
			`Would you like to sell another jump drive to the Unfettered?`
			choice
				`	(No.)`
					defer
				`	(Yes.)`
			`	As usual, they are more than willing to pay you a million credits for your jump drive, but you do not gain any additional information by talking with them.`
				accept
	
	on accept
		outfit "Jump Drive" -1
		outfit "Hyperdrive" 1
		payment 1000000
		"reputation: Hai (Unfettered)" >?= 40
		fail "Unfettered Jump Drive 3"
		fail "Unfettered Jump Drive 4"



mission "Unfettered returning home"
	description "This Hai has asked you to smuggle him out of Unfettered space and bring him to <destination>."
	minor
	source
		attributes "unfettered"
	destination "Hai-home"
	clearance
	passengers 1
	to offer
		has "Unfettered Tribute 3: done"
		random < 40
	on offer
		conversation
			`During the night, you hear a gentle scratching sound on your ship's main hatch. Do you investigate?`
			choice
				`	(Yes.)`
				`	(No.)`
					defer
			`	You grab a flashlight and open the hatch, and find a juvenile Hai there, with a large satchel slung over his shoulder. "You are the <first> <last>, yes?" he says. You nod. He says, "Is it true what is written here?"`
			`	In his hands he is holding a piece of foil paper. You recognize it as the wrapper from one of the food rations that you have been transporting to the Unfettered, the "tribute" that they demand from the peaceful Hai. But having never unwrapped one of the rations, you had not realized that there is writing on the inside, a few words in the angular alphabet of the Hai. The Unfettered youth sees your look of confusion, and translates the message. "It says, 'Hai-home is your home too. Rejoin your people.'"`
			choice
				`	"I think it is true. The Hai who gave this tribute said they hoped the Unfettered would turn from violence and be reconciled with them."`
					goto true
				`	"I'm sorry, but I don't think they will ever let you live among them, if it is your nature to be prone to violence."`
			`	You have little experience reading Hai emotion, but the youth seems crestfallen. "You are certain?" he asks.`
			choice
				`	"I am certain. I can do nothing for you."`
					goto refuse
				`	"Perhaps you can come with me and find out, but don't get your hopes up."`
					goto end
			label true
			`	"Will you take me to Hai-home?" he asks. "You are able to be outside Unfettered places. Can I go with you?"`
			choice
				`	"Yes, I will take you there."`
					goto end
				`	"Sorry, I can't risk angering the Unfettered by carrying a defector."`
			label refuse
			`	Disappointed, the youth leaves. You hope you made the right choice.`
				decline
			label end
			`	You show the youth to one of your bunk rooms, and tell him to stay hidden there until you reach Hai-home.`
				accept
	
	on visit
		dialog `You look for the young Hai, but realize that he took a ride on one of your escorts! Better depart and wait for your escorts to arrive in this star system.`
	on complete
		payment 100000
		dialog
			`You need not have worried about the reception the Unfettered youth would receive here on Hai-home. Scarcely minutes after you hesitantly contact the Hai government, a happy crowd has gathered around your ship. When he steps out of the hatchway, he looks stunned at being welcomed so warmly. One of the Hai governors thanks you for transporting him, and pays you <payment>.`
		"reputation: Hai" += 10



mission "Returning Home"
	description "Bring Elliot home to his family on <destination>. Elliot ran away from his family as a teenager and hasn't seen them in almost six years."
	minor
	source
		government "Hai"
	destination
		attributes "dirt belt"
		attributes "farming"
	passengers 1
	to offer
		random < 40
	on offer
		conversation
			`You are stopped by a human in the <origin> marketplace. He takes off his hat and asks, "You're from the outside, aren't you?"`
			choice
				`	"Yes, I am."`
					goto outsider
				`	"What do you mean 'the outside?'"`
			
			`	"Outside of Hai space. You don't look quite like most humans who live here, unless there's some new fashion trend going on that I don't know about."`
			choice
				`	"Oh, yes. I do come from outside."`
			
			label outsider
			`	"Good. My name is Elliot." You introduce yourself to Elliot and shake hands.`
			`	"Can you take me to <destination>?" Elliot asks.`
			`	"That's all the way in the Dirt Belt," you say. "Why do you want to go that far?"`
			`	Elliot looks down at the ground for a second and takes a deep breath while gripping his hat in his hands. "You see, I haven't lived here all my life. I was born on <planet> to a poor farming family. Most of my days were spent working on the farm, which I hated with a passion. One day I just got fed up with things and I ran away.`
			`	"I ran away from home to the spaceport city and snuck my way into the cargo hold of a freighter. The captain didn't open the cargo hold for three weeks while I stayed in it. Lucky for me the freighter was transporting food, so I had plenty to eat.`
			`	"When the cargo hold doors finally opened, I ran out as fast as I could, only to run back in at the sight of a group of Hai. I had no idea where I was at the time, but I've been living here ever since. That was when I was thirteen, nearly five years ago now."`
			`	Elliot looks down at the ground again and wipes a tear from the corner of his eye.`
			choice
				`	"Alright, I'll take you to <planet>."`
					goto accept
				`	"And you finally want to go back home?"`
				`	"Sorry, but I'm not able to take you that far."`
					goto decline
			
			`	"Yes. I've thought a lot about it lately. I want to see my family again."`
			choice
				`	"Alright, I'll take you to <planet>."`
					goto accept
				`	"Sorry, but I'm not able to take you that far."`
			
			label decline
			`	"I understand," Elliot says. "I'll just try and find someone else to help me. Goodbye, <first>."`
				decline
			
			label accept
			`	You lead Elliot to your ship and show him to a bunk room. After leaving Elliot there, you wonder if his family is still even on <planet> anymore.`
				accept
			
	on visit
		dialog `You look for Elliot, but realize that he took a ride on one of your escorts! Better depart and wait for your escorts to arrive in this star system.`
	on complete
		payment 45000
		conversation
			`Elliot thanks you for bringing him to <planet> and hands you <payment>. He flags down a taxi just outside the spaceport, but before entering the taxi he turns back to you.`
			`	"Do you want to come with me? I'd love for you to meet my family. They'll want to meet you when I tell them how I got back."`
			choice
				`	"Sorry, I have other places to be. Good luck."`
				`	"Sure. I've come with you this far."`
					goto sure
			
			`	"I understand. Thanks again, <first>. I'll always owe you."`
			`	Elliot gets into the taxi, which drives off toward the seemingly endless farmlands outside of the spaceport city.`
				decline
			
			label sure
			`	The view for nearly the entire three hour drive is of hills and farmland with the occasional building or wild animal. Elliot shakes as the taxi approaches the house from the driveway. "I'm wondering if they still even live here," he says nervously.`
			`	No one comes out of the house when the taxi stops. You walk up to the front door with Elliot and a middle-aged woman answers the door with a mug of coffee and a bewildered look on her face.`
			`	"Can I help you?" the woman asks.`
			`	Elliot looks over at you with a big smile on his face. "Yes you can, mom," he says to her. The woman's face lights up with joy and she begins jumping up and down, spilling coffee from her mug.`
			`	"Oh Elliot, I can't believe it!" Elliot's mom puts down her mug and leaps out the door to hug him. "Jackson! Sarah! Abby! Sean! Victor! Elliot is here!" Elliot's entire family comes out from the house and greets him, asking dozens of questions about where and how he's been and why he left.`
			`	Elliot introduces you to his family, who thank you for bringing Elliot home. Victor, who was only seven years old when Elliot left and is now twelve, asks you question after question about being a pilot, sometimes asking new questions before you can even answer the old one.`
			`	"Are you going back to the spaceport, <first>?" the taxi driver yells from the driveway. "I need to get back to the city as soon as I can."`
			`	You say goodbye to Elliot and to his family. "Thanks again, <first>," Elliot says. "I'll always owe you."`



mission "Unwanted Cargo Trigger"
	invisible
	landing
	source
		government "Hai"
	to offer
		random < 10
		"cargo space" > 0
	on offer
		event "hai in cargo" 14
		fail

event "hai in cargo"

mission "Unwanted Cargo"
	landing
	description "Bring a Hai child who hid in your cargo hold back to <destination>."
	source
		government "Republic" "Free Worlds" "Syndicate" "Neutral"
	destination "Allhome"
	to offer
		has "event: hai in cargo"
	on offer
		conversation
			`The "Check Cargo" light for your ship begins blinking when you land, meaning that a cargo crate may have come loose in flight. You shut off the ship's engines and walk to the cargo hold.`
			`	You check every cargo crate in the hold, but can't find anything wrong. Right as you decide to leave, one of the smaller crates begins rocking back and forth.`
			branch translator
				has "language: Wanderer"
				
			`	You hear a voice come from the crate, but it is not a language you understand. The voice continues to speak, and you recognize it as the Hai language.`
			choice
				`	(Open the crate.)`
			`	You open the crate and are met face to face with a Hai child. You aren't sure how old it is, but it looks to be about the size of a one-year-old human child. It tries to communicate with you, but begins to cry when it sees the confused look on your face.`
			choice
				`	"Don't cry, little guy."`
					goto cry
				`	(Pick up the Hai.)`
				
			`	The child waves its hands around when you try to pick it up, making it impossible to grab on to. After waiting for a few minutes, the child finally calms down, eventually going to sleep in the crate.`
				goto end
			
			label cry
			`	The child begins to cry even louder than before. After waiting for a few minutes, the child finally calms down, eventually going to sleep in the crate.`
				goto end
			
			label translator
			`	You hear a voice come from the crate, and surprisingly your Hai translator begins speaking. "Let me out! I want to go home!"`
			choice
				`	(Open the crate.)`
			`	You open the crate and are met eye to eye with a Hai child. You aren't sure how old it is, but it looks to be about the size of a one-year-old human child. "I want my mommy!" it says as its eyes begin to tear up.`
			choice
				`	"Where's your mommy?"`
				`	"Don't cry, little guy."`
			`	The child looks surprised when your translation device speaks to it in Hai. "Take me home!" it yells back at you. You attempt to find out where the child's home is, but it continues to cry for its mother without giving any important information.`
			
			label end
			`	This child must have somehow gotten into your cargo hold while you were in Hai space. Leaving a Hai child on a human world would be an extremely bad idea. Perhaps someone on <destination> will be able to bring the child back to its family.`
				accept
			
	on complete
		payment 50000
		dialog `You contact the spaceport authorities of <planet> and ask them if they are looking for a lost Hai child. It turns out that the family was so worried that they put up a <payment> reward for finding their son. A Hai spaceport worker takes the child from your ship and thanks you for finding him for the family.`



mission "Expanding Business [1]"
	name "An Interesting Proposition"
	description "Travel with businessman David Turner to <destination> where a convoy of freighters are awaiting escort."
	minor
	source "Greenwater"
	destination "Allhome"
	to offer
		has "First Contact: Hai: offered"
		has "main plot completed"
	on offer
		conversation
			`Walking through the <origin> spaceport, you notice that almost half of the people you see are humans, unlike other Hai worlds where the Hai outnumber humans by a sizable degree. A human dressed in a business suit shouts your name from across the street and approaches you.`
			`	"Captain <last>, one of the many heroes of humanity! I noticed you right away when I laid my eyes upon you. I'd like to personally thank you for what you've done."`
			choice
				`	"Glad to get some recognition for all the hard work I've done."`
					goto boast
				`	"Don't mention it. I just did what I could to help."`
					goto downplay
				`	"Can I help you, sir?"`
			
			`	"I'm the one who should be using formal titles to address you, so please, Captain, don't call me sir.`
				goto proposition
			
			label boast
			`	"A personality as big as yourself should be receiving praise and recognition wherever you go! People must really have no respect these days.`
				goto proposition
			
			label downplay
			`	"No need to downplay yourself, Captain! You've done God's work in saving humanity from that alien scourge.`
			
			label proposition
			`	"The name's David Joseph Turner, venture capitalist, entrepreneur, and famous Paradise Worlds businessman." Turner grabs a business card from his pocket and hands it to you. The card contains his contact information, an address on Martini, and makes sure to boast in golden letters his net worth of more than three billion credits.`
			`	"You may not have heard of me, but I've sure as hell heard of you, and I'd like to make a proposition to you." Turner turns around and waves his arm across the crowd of people in the spaceport. "You see all the humans here? About one out of every four of these people only arrived here after war broke out through the wormhole. Captains who knew of the Hai came flocking here in droves after the Navy entered Kornephoros, hoping to avoid any troubles that the war would bring. Some captains returned after the war ended, but most stayed, and I see a massive market opportunity in that."`
			branch rich
				"net worth" >= 4000000000
			
			choice
				`	"What kind of market opportunity?"`
					goto opportunity
				`	"Sorry, but I don't have the time to talk about this."`
					goto walk
			
			label rich
			choice
				`	"What kind of market opportunity?"`
					goto opportunity
				`	"You're only worth three billion credits? Why shouldn't I pursue your opportunity on my own?"`
				`	"Sorry, but I don't have the time to talk about this."`
					goto walk
			
			`	"Of course you're worth more than me, Captain <last>, but you are no business owner. I have the connections and skills, but a name like yours will always help.`
				goto opportunity
			
			label walk
			`	You try to walk away, but Turner stops you by grabbing your arm and continues to talk.`
			
			label opportunity
			`	"Allow me to explain. The journey to the Hai can be a dangerous one, and you know that. I heard many stories during the war of merchants trying to reach the Hai, but thanks to the Navy being distracted, those merchants fell victim to pirates patrolling the systems of the Far North. Now that many merchants are here, they're trapped. They expended most of if not all of their ammunition trying to get here, and now they have none to defend them on their way back. Human ammunition has become a scarce commodity among human captains in this region of space, leaving open a market that's just waiting to be cornered.`
			`	"I'd like you, Captain <last>, hero of humanity, to help me set up an outfitter here on <origin>, an outfitter that would supply these desperate merchants with relief by supplying them with the ammunition they need, along with outfits they might want to buy for their old ships. I've already received approval from the Hai government for the construction of an outfitter, and with a name like yours backing up this business, the profits are sure to be phenomenal, profits that you would be sharing in by being a founding member of this outfitter."`
			choice
				`	"This sounds like a good idea to me. What do you need me to do?"`
					goto interested
				`	"Sorry, but I'm not interested in your proposition."`
			
			`	"Nonsense, Captain! All you'd need to do is help escort a few freighters from <planet> to Follower and back to here, and for so simple a job you could be receiving enough money to not work another day in your life, or perhaps even support a massive fleet."`
			choice
				`	"Again, I'm not interested. Goodbye."`
				`	"Alright, you have my attention."`
					goto interested
			
			`	"Well, I tried, Captain," Turner says with a smirk. "I'll just have to travel back to the Paradise Worlds and make my money in other areas of business, then." He hands you another business card and winks. "Goodbye, Captain <last>. You should know where to find me if you need me. Perhaps we can pursue this venture together in the future."`
				decline
			
			label interested
			`	"Excellent, Captain! I'll be making myself comfy on my own ship. A convoy of freighters is waiting for us on <destination>. From there, we're off to Follower to pick up supplies."`
				accept
				
	npc accompany save
		personality escort
		government "Merchant"
		ship "Star Queen (Hai)" "Chryso Vasilia"
	
	on visit
		dialog `You've reached <planet>, but you've left Turner behind. Wait for Turner's ship to arrive before landing.`
	
	on complete
		dialog `The freighters are ready to launch by the time you get to <planet>. "Now we just need to escort these freighters to Follower in the Alphard system and back in one piece," Turner exclaims, hopping back on to his Star Queen.`



mission "Expanding Business [2]"
	landing
	name "An Interesting Proposition"
	description "Escort the freighters to <destination> where they will pick up supplies for the Greenwater outfitter."
	destination "Follower"
	to offer
		has "Expanding Business [1]: done"
	
	npc accompany save
		personality escort
		government "Merchant"
		ship "Star Queen (Hai)" "Chryso Vasilia"
	npc accompany save
		personality escort
		government "Merchant"
		fleet
			names "civilian"
			variant
				"Bulk Freighter (Hai)" 3
	
	npc
		personality staying
		government "Pirate"
		system "Ultima Thule"
		fleet "Small Northern Pirates"
	npc
		personality staying
		government "Pirate"
		system "Rajak"
		fleet "Large Northern Pirates"
	npc
		personality staying
		government "Pirate"
		system destination
		fleet "Large Northern Pirates"
	
	on visit
		dialog `You've reached <planet>, but you've left one of the ships you're supposed to be escorting behind. Wait for Turner's ship and all the Bulk Freighters to arrive before landing.`



mission "Expanding Business [3]"
	landing
	name "An Interesting Proposition"
	description "Escort Turner's ship to <destination> so that he can speak with an old friend."
	destination "Rust"
	to offer
		has "Expanding Business [2]: done"
	on offer
		conversation
			`Turner jumps off of his Star Queen before the boarding ramp fully reaches the ground, clearly eager to get moving with this project.`
			`	Turner swears under his breath when he walks up to you. "Low life pirates giving us trouble on the way here. That's the kind of trouble I'm talking about that an outfitter in Hai space would help with. There's no telling what would have happened had my Bulk Freighters not had their missiles. Or if you were not there to protect them, of course."`
			`	Turner has a talk with the spaceport authorities, and within a short amount of time the necessary cargo is loaded on to the freighters. When the freighters are fully loaded, they take off without even giving you time to get to your ship.`
			`	"They can get back to Greenwater on their own," Turner says from behind you as you watch the freighters fly off. "I told them to leave as soon as they could. As for you and me, I need escort to <destination>. I received a message from an old friend there who would like to have a chat with me."`
				accept
				
	npc accompany save
		personality escort
		government "Merchant"
		ship "Star Queen (Hai)" "Chryso Vasilia"
		
	on visit
		dialog `You've reached <planet>, but you've left Turner behind. Wait for Turner's ship to arrive before landing.`



mission "Expanding Business [4]"
	landing
	name "An Interesting Proposition"
	description "Escort Turner back to <destination> to oversee the construction of the outfitter."
	destination "Greenwater"
	to offer
		has "Expanding Business [3]: done"
	on offer
		conversation
			`Turner lands his ship outside of the Kraz Cybernetics building. "Wait here while I have a talk with my friend, Edward. This should only take a few minutes."`
			`	A few hours later, Turner returns carrying a black suitcase. "Sorry, that took longer than I expected. Now, let's get back to <destination>."`
				accept
	
	npc accompany save
		personality escort
		government "Merchant"
		ship "Star Queen (Hai)" "Chryso Vasilia"
	
	on visit
		dialog `You've reached <planet>, but you've left Turner behind. Wait for Turner's ship to arrive before landing.`
	
	on complete
		event "outfitter on greenwater" 95
		log "People" "David Turner" `An entrepreneur with a sharp mind, he was instrumental in the creation of a human outfitter in Hai space, allowing merchants to arm themselves for the dangerous trip back to human space.`
		conversation
			`By the time you finally reach <planet>, construction on the outfitter is already underway. The construction workers have laid the foundation of the outfitter close to the spaceport, taking up a good portion of a park.`
			`	"I had to pay a pretty penny to get the outfitter this close to the spaceport," Turner says to you, "but it'll all be worth it in the end.`
			`	"The outfitter should be done in three months or so. You'll know it's done once you find an extra two thousand credits in your pocket every day." Turner pats you on the back. "Have fun until then, Captain <last>. Keep yourself busy saving the galaxy."`

event "outfitter on greenwater"
	planet "Greenwater"
		outfitter "Basic Outfits"
		outfitter "Ammo North"
		outfitter "Ammo South"

mission "Expanding Business: outfitter complete"
	landing
	invisible
	to offer
		has "event: outfitter on greenwater"
	on offer
		"salary: Turner Incorporated" = 2000
		event "request for a shipyard" 270
		fail

event "request for a shipyard"



mission "Expanding Business [5]"
	landing
	name "A New Proposition"
	description "Meet with David Turner on <destination> to talk about a new proposition."
	source
		government "Hai"
	destination "Greenwater"
	to offer
		has "event: request for a shipyard"
	on offer
		dialog `You receive a message from David Turner when you land. "Hello, Captain. I hope you've been enjoying your share in the outfitter. I have a new proposition for you, as I've bought out the rest of the park around the outfitter. Meet me on <destination> if you'd like to hear about it."`



mission "Expanding Business [6]"
	landing
	name "A New Proposition"
	description "Escort the freighters to <destination> in order to pick up the supplies for the shipyard."
	destination "Sunracer"
	to offer
		has "Expanding Business [5]: done"
	on offer
		conversation
			`Turner meets you in a high-end human-owned restaurant in the richer part of the city, very much reminiscent of something you would find on a Paradise Planet. "It's been quite some time since we last spoke, Captain <last>. Over a year now," he says. "Have you been enjoying the extra cash in your pocket every day, Captain <last>?"`
			choice
				`	"Yes. It's been a huge help paying crew salaries."`
					goto salaries
				`	"Two thousand credits each day isn't much for me."`
			
			`	"I suppose two thousand credits every day wouldn't be much to a hero such as yourself. Spaceships are expensive, after all. How does four thousand credits every day sound to you?"`
				goto choice
			
			label salaries
			`	"I'm glad to hear that, Captain <last>. I spent my early years as a captain myself, and I didn't much enjoy having to worry about crew salaries every day. Perhaps doubling that amount will help even more."`
			
			label choice
			choice
				`	"Am I getting a raise?"`
				`	"Is this part of your new proposition?"`
					goto proposition
			
			`	"You could call it that," Turner says after sipping from his glass of wine.`
			
			label proposition
			`	"Building an outfitter selling human goods here on <origin> has had to be the best idea I've ever had, Captain <last>, but recently I thought of an even better idea. You see, most of the humans you see flying around in Hai space are flying decades-old ships. Hai ships are prohibitively expensive for humans. The Hai sell the Aphid for nearly one and a half million credits! This means that demand for ships is extremely high among humans, Captain <last>. Do you see where I'm going with this? You look at something we humans sell like a Star Barge, which is hardly worse than an Aphid for only a quarter of the price, and you start to see the problem."`
			choice
				`	"You need me to help you escort freighters again?"`
				`	"Do you want to build a shipyard selling human ships?"`
			
			`	"Yes, Captain. Right now, the only realistic way that a human born here can get a ship is if they know a captain willing to retire. Even then, prices for a human ship can be more than twice what they are across the wormhole. It's preposterous, Captain <last>!`
			`	"I've already made arrangements with the local Hai government. The rest of the park next to the outfitter is now my property, and I intend to use it to build the shipyard. I've also contacted Megaparsec and bought a license to build their ships and some of the outfits they sell on <planet>. My freighters are at the ready in the spaceport right now. All I need you to do is escort them to <destination> and back, and in six to seven months' time when the shipyard is done, you'll reap the rewards. What do you say, Captain <last>? Do you want to be a hero to millions once again?"`
			choice
				`	"Sure, this sounds like a great idea."`
					goto accept
				`	"I'm not interested in working with you anymore, Turner."`
			
			`	Turner smirks at your response. "Understood, Captain <last>. I'll just save myself two thousand credits a day from now on by rescinding your salary. I'll be seeing myself out now."`
			choice
				`	"Goodbye."`
					decline
				`	"Wait! I changed my mind. I'll help you."`
			
			label accept
			`	"Excellent decision, Captain <last>. I'll meet you outside to send the ships off."`
				accept
			
	on decline
		clear "salary: Turner Incorporated"
	
	npc accompany save
		personality escort
		government "Merchant"
		ship "Star Queen (Hai)" "Chryso Vasilia"
	npc accompany save
		personality escort
		government "Merchant"
		fleet
			names "civilian"
			variant
				"Bulk Freighter (Hai)" 3
	
	npc
		personality staying
		government "Pirate"
		system "Ultima Thule"
		fleet "Small Northern Pirates"
	npc
		personality staying
		government "Pirate"
		system "Rajak"
		fleet "Large Northern Pirates"
	npc
		personality staying
		government "Pirate"
		system destination
		fleet "Large Northern Pirates"
		
	on visit
		dialog `You've reached <planet>, but you've left one of the ships you're supposed to be escorting behind. Wait for Turner's ship and all the Bulk Freighters to arrive before landing.`

	on complete
		dialog `The Bulk Freighters are loaded with supplies without any problem. When one of the spaceport workers asks Turner where the supplies are going, he replies, "These are just to expand a business venture of mine on, uh, Glory."`



mission "Expanding Business [7]"
	landing
	name "A New Proposition"
	description "Escort the freighters back to <destination> to begin construction on the shipyard."
	destination "Greenwater"
	to offer
		has "Expanding Business [6]: done"
	
	npc accompany save
		personality escort
		government "Merchant"
		ship "Star Queen (Hai)" "Chryso Vasilia"
	npc accompany save
		personality escort
		government "Merchant"
		fleet
			names "civilian"
			variant
				"Bulk Freighter (Hai)" 3
	
	npc
		personality staying
		government "Pirate"
		system "Cardax"
		fleet "Small Northern Pirates"
	npc
		personality staying
		government "Pirate"
		system "Rajak"
		fleet "Large Northern Pirates"
		
	on visit
		dialog `You've reached <planet>, but you've left one of the ships you're supposed to be escorting behind. Wait for Turner's ship and all the Bulk Freighters to arrive before landing.`

	on complete
		event "shipyard on greenwater" 180
		conversation
			`	Construction on the shipyard begins almost immediately after the supplies are unloaded from the freighters, starting with the demolition of the rest of the park. A downtrodden-looking crowd gathers to watch the demolition, but Turner assures you that there are plenty of other parks in the city for them to go to.`
			`	"Something big is going to come of this, Captain <last>," Turner says. "Just know that you were all part of it. You'll know the shipyard is done when you find an extra four thousand credits in your pocket each day. Goodbye until then, Captain <last>."`

event "shipyard on greenwater"
	planet "Greenwater"
		shipyard "Basic Ships"
		shipyard "Syndicate Basics"
		shipyard "Megaparsec Basics"
		shipyard "Megaparsec Advanced"
		outfitter "Common Outfits"
		outfitter "Syndicate Advanced"
		outfitter "Lovelace Basics"
	fleet "Small Human Merchants (Hai)"
		add variant 20
			"Sparrow"
		add variant 20
			"Star Barge"
		add variant 20
			"Shuttle"
		add variant 5
			"Freighter"
			"Wasp" 2
		add variant 10
			"Freighter"
			"Shuttle" 2
			"Quicksilver"
		add variant 15
			"Bounder"
			"Wasp" 2
		add variant 5
			"Manta"
		add variant 5
			"Freighter" 2
			"Manta"
	fleet "Large Human Merchants (Hai)"
		add variant 6
			"Freighter (Proton)" 2
			"Quicksilver" 2
		add variant 6
			"Freighter" 4
			"Quicksilver" 2
			"Splinter" 1
		add variant 3
			"Freighter" 4
			"Quicksilver" 2
			"Splinter (Laser)" 1
		add variant 3
			"Freighter" 4
			"Quicksilver" 2
			"Splinter (Proton)" 1

mission "Expanding Business: shipyard complete"
	landing
	invisible
	to offer
		has "event: shipyard on greenwater"
	on offer
		"salary: Turner Incorporated" = 4000
		fail



mission "Hiding in Plain Sight"
	description "Bring Arthur and his Hai friend, Kiru, to <destination> for a gaming convention."
	minor
	source
		government "Hai"
	destination "Vinci"
	passengers 2
	to offer
		random < 30
		has "First Contact: Hai: offered"
	on offer
		conversation
			`While eating in a spaceport cafeteria that serves both Hai and human cuisine, you are approached by a teenage human and Hai. "Hello. Do you know how to get to <destination>?" the Hai asks.`
			choice
				`	"I do. Why do you want to go there?"`
				`	"I don't. You'll have to ask someone else."`
					decline
			`	The human responds, "There's a massive convention on <planet> for a game called 'Boundless Frontiers.' The convention has a huge cosplaying scene, and I think Kiru would fit right in."`
			`	"Arthur and I have <payment> to give you if you bring us to the <planet>," Kiru says. "We can find our own way back to the Hai space, as well."`
			choice
				`	"Alright, I can take you there."`
					accept
				`	"Sorry, you'll have to find someone else to bring you."`
					decline
					
	on visit
		dialog `You look for Arthur and Kiru, but realize that they took a ride on one of your escorts! Better depart and wait for your escorts to arrive in this star system.`
	on complete
		payment 75000
		dialog `Arthur and Kiru pay you <payment> before running off to the convention center. As they run away, you notice that Kiru is drawing a number of eyes from the crowd, but no one seems to suspect that he is an actual alien.`
		log "Minor People" "Arthur and Kiru" `Human and Hai respectively, both attended the Vinci cosplay convention without a costume, gaining much attention.`



mission "Hai Honeymoon"
	description "Bring Anaya and Touhar to <destination> for their honeymoon."
	minor
	source "Skyfarm"
	destination "Featherweight"
	passengers 2
	to offer
		random < 60
		has "First Contact: Hai: offered"
	on offer
		conversation
			`You hop around the spaceport of <origin>, trying to adjust to the low gravity of this moon, when you are approached by a toweringly tall human woman and an equally tall Hai male who are clearly having no trouble with <origin>'s gravity.`
			`	"You look like you need help there, Captain," the woman says with a chuckle.`
			choice
				`	"Don't worry. I almost have the hang of it."`
				`	"Maybe a little bit."`
			`	"It's always fun watching captains when they step off the comfort of their ship," the Hai says.`
			`	"At least they're trying, Touhar," the woman says.`
			choice
				`	"Can I help you two with something?"`
				`	"Is there something I can help you with, or are you just going to watch me?"`
			`	"Actually, there is something," the woman says. "My name is Anaya, and this is my husband, Touhar. And you are?"`
			choice
				`	"My name is <first> <last>."`
				`	"Wait, your husband?"`
					goto husband
			
			`	"Very nice to meet you, Captain <last>," Touhar says to you.`
				goto next
			
			label husband
			`	"What, you've never seen an interspecies couple before?" Touhar asks with a hint of sarcasm in his voice.`
			
			label next
			`	"We got married last week, and we were hoping to travel to <destination> for our honeymoon. I know it's risky to bring Touhar into human space, but <planet> is a sparsely inhabited world, and I have a friend who owns a house in the mountains far from anyone who could see him."`
			`	"Said friend will be able to arrange for our return to <origin> as well," Touhar adds. "Will you take us?"`
			choice
				`	"Sure."`
					accept
				`	"Sorry, I can't travel that far from here."`
					decline
					
	on visit
		dialog `You look for Anaya and Touhar, but realize that they took a ride on one of your escorts! Better depart and wait for your escorts to arrive in this star system.`
	on complete
		payment 100000
		dialog `Instead of landing in the spaceport where they can be seen, you drop Anaya and Touhar off as close as you can to where they will be staying. The house is a few kilometers away, but they assure you that they can make it on their own. They pay you <payment> and thank you for bringing them this far.`
		log "Minor People" "Anaya and Touhar" `A Hai-human interspecies couple that you transported to their secluded honeymoon on Featherweight in human space.`



mission "Pirate Troubles [0]"
	name "Defend <system>"
	description "A sizable group of pirates has found their way into Hai space and is terrorizing the system. Help the Hai fight back against them."
	source
		near "Waypoint" 2
		government "Hai"
	to offer
		has "First Contact: Unfettered: offered"
		"combat rating" > 1100
		random < 10
	on offer
		conversation
			`The peaceful spaceport is suddenly filled with the harsh sound of sirens. You spot some Hai and a small number of humans running to their ships and speeding quickly into orbit. It appears that the system is under attack, but the Unfettered Hai never reach this far south. A loud speaker begins blaring throughout the spaceport: "Unfettered humans have entered the system in a large fleet and have begun attacking! Requesting all combat-worthy pilots to assist in the defense of our space. These enemies of harmony are not welcome here."`
			branch unfettered
				has "Unfettered: Jump Drive Source: offered"
			`	You find the phrase "unfettered humans" odd, but guess that they may be referring to pirates. The Hai will probably be very gracious if you help, but this could also be an easy way to get yourself killed, especially if a group of pirates is bold enough to attack the Hai.`
				goto choice
			
			label unfettered
			`	Your heart drops at the phrase "unfettered humans," as the last time you heard that was when the Unfettered Hai used that phrase to refer to the Alphas. If it is really the Alphas attacking the Hai, then it is probably a good idea to help.`
			label choice
			choice
				`	(Join the defense fleet.)`
					launch
				`	(Stay here until the fight is over.)`
					decline
	npc
		government "Hai"
		personality staying
		fleet "Large Hai"
	npc
		government "Merchant"
		personality staying
		fleet "Large Human Merchants (Hai)"
	npc evade
		government "Pirate"
		personality staying
		fleet
			names "pirate"
			variant
				"Leviathan" 2
				"Mule" 2
				"Firebird"
				"Headhunter" 3
				"Raven" 3



mission "Pirate Troubles [1]"
	landing
	name "Unfettered Humans"
	description `Track down the leaders of the pirate gang "Scar's Legion" and "persuade" them to stop attacking Hai space, then return to <destination> to tell the Hai.`
	source
		government "Hai"
	destination "Hai-home"
	clearance
	to offer
		has "Pirate Troubles [0]: done"
	on offer
		"reputation: Hai" += 20
		conversation
			`The battle has ended, but the spaceport still seems more hectic than usual. Ships are jumping in from the surrounding systems to help any injured and to repair any damage that may have occurred. After some hours pass and the commotion has died down, a Hai elder approaches you. "We have heard from the humans here that you are considered a seasoned fighter among your people. May you lend your combat prowess to us to resolve this issue?"`
			choice
				`	"I'd be glad to help. What can I do?"`
					goto explain
				`	"What issue?"`
			`	"I understand that you just defended this system from human pirates. That is the issue that needs resolved.`
			label explain
			`	"Human attacks on our systems are very rare, but recently we have experienced an increased number of raids. Not all have been as unsuccessful as this one. We captured a crew member of this most recent attack who was attempting to flee in an escape pod, and he gave us information that a gang that calls themselves 'Scar's Legion' has discovered our territory and is responsible for the recent raids.`
			`	"Unfortunately, he would not tell us where this gang is, or who the leader is, so there is nothing we are able to do about it. Many humans who live peacefully among us told us that you might be capable of assistance, though."`
			choice
				`	"I'll see what I can do."`
					goto yes
				`	"You want me to hunt down Scar's Legion to stop them from attacking you?"`
				`	"Sorry, I'm not interested."`
					decline
			`	"We understand that these humans are likely misguided. We ask that you resolve this peacefully if possible, but the loss of life from these continued attacks is unacceptable."`
			choice
				`	"I'll see what I can do."`
					goto yes
				`	"Sorry, but I'm not interested."`
					decline
			label yes
			`	"Thank you. Please return to <destination> after you have sought to resolve this situation."`
				accept
	on visit
		dialog "You've returned to <planet>, but you haven't yet tracked down Scar's Legion. Perhaps you should ask around the spaceport of pirate planets near the wormhole into Hai space for information."
	to complete
		or
			has "accepted scar's legion tribute"
			has "defeated scar's legion"



mission "Pirate Troubles [1]: Farpoint"
	landing
	invisible
	source "Farpoint"
	to offer
		has "Pirate Troubles [1]: active"
	on offer
		conversation
			`You visit the Navy outpost on <origin> and ask the officers there if they have any information on Scar's Legion. After running a background check on you to make sure you're not up to no good, an officer hands you a copy of a folder containing all the information that the Navy has on the gang. "Nothing in here is classified, so you're free to keep it," the officer says.`
			`	You return to your ships and sift through the files. The leader of the gang is named Scar (to no one's surprise), who used to be an important member of another pirate gang before forming his own. The Navy estimates their numbers to be in the low thousands, mostly responsible for petty crime in the Far North and not a cause of too much trouble, but the files all date back to a number of years ago. Clearly something has changed in the time since these files were last updated if Scar's Legion is now powerful enough to even attempt to attack the Hai.`
				decline



mission "Pirate Troubles [1]: Freedom or Zenith"
	landing
	invisible
	source 
		planet "Freedom" "Zenith"
	to offer
		has "Pirate Troubles [1]: active"
	on offer
		payment -5000
		conversation
			`You wander the <origin> spaceport on the lookout for anyone who might have any information on the whereabouts of Scar's Legion. A self-described fixer promises you information in exchange for payment, but after handing her the few credits that she's asking for, she runs off with her gun in her hands to discourage you from following. Perhaps someone on another nearby pirate planet will have actual information for you.`
				decline



mission "Pirate Troubles [1]: Haven"
	landing
	invisible
	source "Haven"
	to offer
		has "Pirate Troubles [1]: active"
	on offer
		payment -100
		"scar's legion information" ++
		conversation
			`You order a drink from a small rundown bar in the <origin> spaceport and try to make small talk with the bartender to get him open to giving information about Scar's Legion. He seems reluctant at first, but eventually warms up to you. A few other patrons of the bar join in on the conversation. Luckily no one seems mad about you asking about Scar's Legion. One of the patrons makes it clear that Scar's Legion has no friends on this world, "at least not anymore."`
			`	You leave the bar after an hour or two. Once you return to your ship, you write down all the information you can remember. The gang used to operate exclusively out of the Far North until they crossed one of the larger gangs, causing them to flee the region a few years ago. One of the pirates guessed that they fled for the Core.`
			`	Another person mentioned that the leader of the gang used to always talk about making their own base in an uninhabited system where no one would find it. "He always talked about hollowing out an asteroid to use as a hideout. My guess is he was just always high on the ringworld shavings his gang was dealing."`
				decline



mission "Pirate Troubles [1]: Stormhold"
	landing
	invisible
	source "Stormhold"
	to offer
		has "Pirate Troubles [1]: active"
	on offer
		"scar's legion information" ++
		conversation
			`It doesn't take long for you to find someone who knows something about Scar's Legion. You meet someone who says he'll give you information "free of charge."`
			`	"Scar's Legion have been a thorn in my side for months now. Wrecked my ship a while back, and have been causing me trouble ever since. If you're planning on taking them out, then I'll tell you everything you need to know."`
			`	The pirate tells you that he doesn't know where the base of Scar's Legion is, but he mentions that they spend a lot of time in the uninhabited systems of the Far North. "Nothing out there but cold rocks and gas giants, but if they're spending so much time out there then they must have set up a base of some sort on one of those frozen planets."`
				decline



event "scar's hideout"
	system "Danoa"
		object
			sprite star/m4
			period 10
		object
			sprite planet/desert7-b
			distance 168.64
			period 75.3935
		object
			sprite planet/fog0-b
			distance 693.93
			period 629.313
			object
				sprite planet/mercury
				distance 174
				period 15.1961
		object
			sprite planet/gas6
			distance 2069.42
			period 3240.9
			object
				sprite planet/lava1-b
				distance 293
				period 11.3672
			object
				sprite planet/rock0-b
				distance 440
				period 20.9186
			object
				sprite planet/lava2-b
				distance 607
				period 33.895
			object "Scar's Hideout"
				sprite "planet/asteroid base"
				distance 809
				period 52.153

planet "Scar's Hideout"
	attributes uninhabited
	landscape land/loc1
	description "Scar's Hideout is a hollowed out asteroids used by Scar's Legion as their main base of operations. From here they harass anyone making the journey through the uninhabited systems of the Far North. Recently the gang has discovered the wormhole to Hai space, leading them to start causing trouble for more than just unlucky merchants."
	spaceport "The spaceport of Scar's Hideout is a massive hangar dug into the core of the asteroid, accessible only by a single blast door on the ceiling. Judging by the size of the hangar, you'd guess that about a third of the entire asteroid was hollowed out for the spaceport alone."
	security 0
	government "Scar's Legion"

mission "Pirate Troubles [2]"
	landing
	name "Scar's Legion"
	description "You've pieced together enough information to find out that the Scar's Legion hideout is in one of four systems in the Far North. Search those systems for the gang's hideout and confront them."
	waypoint "Danoa"
	waypoint "Rajak"
	waypoint "Sumar"
	waypoint "Hassaleh"
	to offer
		"scar's legion information" >= 2
	on offer
		event "scar's hideout"
		conversation
			`After having visited various pirate worlds asking about Scar's Legion, you believe that you know where their hideout is.`
			`	You know that the leader of Scar's Legion use to talk about wanting a hollowed out asteroid as a base. You also know that Scar's Legion has recently been very active in the uninhabited systems of the Far North. You conclude that the gang's hideout could is likely an asteroid located in one of a few systems that are in proximity to the wormhole that leads to the Hai. You mark <waypoints> on your map and get ready to confront them.`
				accept
	to complete
		never
	to fail
		has "Pirate Troubles [3]: offered"



event "battle against scar's legion"
	system "Danoa"
		fleet "Human Miners" 1600

event "battle against scar's legion over"
	system "Danoa"
		fleet "Small Northern Merchants" 15000
		fleet "Small Northern Pirates" 5000
		fleet "Large Northern Pirates" 16000
		fleet "Large Republic" 30000
		fleet "Human Miners" 1600

mission "Pirate Troubles [3]"
	landing
	name "Scar's Legion"
	description "Having declined the tribute, the leader of Scar's Legion has challenged you to a fight to the death. Defeat the <npc>, then return to <destination>."
	source "Scar's Hideout"
	destination "Hai-home"
	to offer
		has "event: scar's hideout"
	on offer
		conversation
			`You've located the Scar's Hideout, a massive asteroid in orbit around a gas giant. As you fly over the asteroid's surface, you spot an open blast door. They must be inviting you inside. It surprises you that a gang of pirates would be capable of creating such a base, as the materials and time needed to make something like this are immense.`
			`	Upon entering the blast door, it closes behind you, leaving you in complete dark. Suddenly, floodlights flash on all around your ship. The brightness of the lights prevents you from seeing anyone beyond them, but you suspect that there are a number of weapons pointed at your ship right now.`
			`	"Who are you and what do you want?" a voice booms from a loud speaker. You press a button to activate your ship's external speakers.`
			choice
				`	"I'm <first> <last>, here to negotiate on behalf of the Hai."`
					goto negotiate
				`	"I'm <first> <last>, here to take this gang down."`
			`	The voice laughs. "Well too bad, because you're right in the middle of a hornet's nest. Fire, boys!"`
				goto die
			
			label negotiate
			`	The voice laughs. "Ah, yes. Those squirrels. I take it they've had enough of us plundering their systems. Boys!"`
			`	The floodlights turn off, revealing a large room with what must be hundreds of pirates with guns of various sizes trained on your ship. One wrong move and you're toast. "Please, Captain. Step out of your ship."`
			choice
				`	(Comply with the orders.)`
					goto comply
				`	(Attempt to escape.)`
			`	You activate your ship's engines to escape. The floodlights suddenly reactivate.`
			
			label die
			`	Before you can even react, several dozen lasers and streams of bullets come flying out from behind the floodlights. You attempt to pull your ship up and fly straight through the ceiling before your ship is too damaged to move, but then you spot a number of rockets flying straight at your cockpit. You die instantly as the rockets impact the glass in front of you.`
				die
			
			label comply
			`	You step out of your ship, and a tall man with a scar across his cheek steps forward from the crowd of pirates, presumably the leader of the gang.`
			choice
				`	"The Hai ask that you stop attacking their systems."`
					goto negotiations
				`	"You must be Scar."`
			`	"No. Scar is long dead," the leader says.`
			choice
				`	"Oh, so does that make you Scab?"`
				`	"The Hai ask that you stop attacking their systems."`
					goto negotiations
			`	The leader grimaces. "I'll cut your tongue out if you don't watch your mouth."`
			`	You take a step back. "The Hai ask that you stop attacking their systems," you say, attempting not to get shanked.`
			
			label negotiations
			`	"Perhaps we will stop," the leader says with a smile. "Under one condition. We'd like a one time shipment of various Hai weapons and technology. The shipment should be as big as possible. I've seen the freighters those aliens have. They're massive. Load two or three up with the goods and we'll consider focusing our attention elsewhere."`
			choice
				`	"Okay. I'll meet with the Hai and see what they can provide."`
					goto tribute
				`	"I'm afraid that I can't allow that."`
			`	The crowd of pirates response with a cacophony of jeers and boos. The leader raises his fist in the air, and the crowd falls silent. "Well I'm afraid that just won't do."`
			`	The leader paces back and forth in silence for a moment. "Well if we don't get what we want, then we're just going to need to keep on attacking. Which means that your presence here is pretty useless."`
			`	The leader turns to the crowd. "How about a fight? To the death!" The crowd erupts in cheers. The leader turns back to you. "We fight in this system only. Just you and me. You attempt to run, my men hunt you down. How's that sound?" You attempt to respond, but before you can, the leader pulls his gun and aims it at you. "Run."`
				launch
			
			label tribute
			`	"Excellent!" the pirate says, which is met with cheers from the rest of the pirates in the room. "But make it quick. Wouldn't want to keep us waiting." The blast doors reopen, and you return to your ship to leave immediately.`
				flee
	
	on decline
		set "accepted scar's legion tribute"
	on accept
		event "battle against scar's legion"
	
	npc kill
		government "Scar's Legion (Killable)"
		personality nemesis
		ship "Leviathan (Hai Weapons)" "Keloid"
		dialog "You've defeated the leader of Scar's Legion. The various spectators to the fight aren't attacking you, but it may only be a matter of time before they decide to turn their guns on you for killing their leader. Better head to <destination> before that happens."
	
	npc
		government "Scar's Legion"
		personality nemesis
		fleet "Small Northern Pirates"
		fleet "Large Northern Pirates" 4
	
	on enter
	on enter
		"reputation: Scar's Legion" = -1000
	
	on visit
		dialog phrase "generic bounty hunting on visit"
		
	on complete
		set "defeated scar's legion"
		event "battle against scar's legion over"



mission "Pirate Troubles [4]"
	landing
	name "Pirate Tribute"
	description "Escort the three Hai freighters carrying Hai weapons and technology to <stopovers>, then escort the freighters back to <destination>."
	source "Hai-home"
	stopover "Scar's Hideout"
	clearance
	to offer
		or
			has "defeated scar's legion"
			has "accepted scar's legion tribute"
	on offer
		"reputation: Hai" += 20
		payment 2500000
		conversation
			`Upon landing on <origin>, the Hai authorities give you <payment> for your assistance in defending their systems and for helping to track down the culprits. You're sent to the council of elders, the elected ruling body of the Hai, to tell them about Scar's Legion. "Please, tell us what has occurred," one of the elders says.`
			branch defeated
				has "defeated scar's legion"
			
			`	"They asked that you load three large freighters with various weapons and technology to give to them. Only then will they stop attacking you."`
			`	"A simple request," the elders says. "Little more than what the Unfettered ask of us. We shall load three Geocoris immediately."`
			`	"Who is to say that they will not use our own weapons against us?" another elder chimes in. "This deal could only hurt us."`
			choice
				`	"There's no guarantee that they will not attack again, but they promised that they would focus elsewhere."`
					goto guarantee
				`	"I could return to them and defeat them if you desire."`
			`	"No," says the elder. "We are not interested in condemning these humans to death if all they ask is for technology."`
			
			label guarantee
			`	"I believe a bigger issue here is how this will impact our human friends beyond the wormhole," an elder says. "If these pirates are not attacking us, then who will they be attacking? Will we not simply become weapons dealers for a far off war?"`
			`	"We will inform the Republic Navy that we are providing these pirates with our technology for our own sake. They have been capable of combating our technology in the past. I am sure that they will be able to handle it now. Please, <first>, escort the freighters to these pirates so that they may leave us alone."`
				accept
			
			label defeated
			`	"I defeated the leader of Scar's Legion. They shouldn't cause any more trouble for you now."`
			`	One of the elders frowns. "Did you kill their leader in cold blood, or was it self defense?"`
			choice
				`	"They asked for a tribute of your weapons and technology, but I refused the offer, so they attacked me."`
					goto refused
				`	"They were not willing to negotiate, and I was forced to defend myself."`
			`	"This is most unfortunate," another elder says. "But I am happy to hear that they will not cause any more loss of life among our people."`
				goto end
			
			label refused
			`	"This is most unfortunate," another elder says. "We would have been willing to provide them the technology they sought if only they had asked nicely in the first place."`
			`	"Better that we eliminate a threat instead of making them stronger through becoming their weapons dealer," the first elder says. "These pirates might have attacked us with our own technology, or worse still, attacked other humans with them, making us complicit in this slaughter."`
			
			label end
			`	The elders thank you for your assistance in this situation and send you on your way.`
				decline
	
	on decline
		"reputation: Hai" += 40
	
	npc save accompany
		government "Hai (Wormhole Access)"
		personality escort
		fleet
			names "hai"
			cargo 10
			variant
				"Geocoris" 3
	
	on stopover
		dialog `You lead the Hai freighters into the blast doors. Despite the massive size of the freighters, they all manage to fit into the asteroid's spaceport with some room to spare, a testament to how much work was put into this base. The pirates of Scar's Legion unload all the Hai technology from the freighters. After the last crate is gone, the freighters quickly launch from the asteroid.`
	
	on visit
		dialog phrase "generic arrived-without-npc dialog"
	
	on complete
		"reputation: Hai" += 40
		payment 500000
		dialog `With the freighters safely returned, the Hai thank you for resolving the situation with Scar's Legion and hand you <payment> for your help.`



mission "Nanachi 1"
	name "Escort Nanachi to <planet>"
	description "Help Nanachi, a Hai who just bought her first ship, make a simple delivery to <destination> by <date>."
	minor
	source "Giverstone"
	destination "Cloudfire"
	deadline
	to offer
		"net worth" > 20000000
		"combat rating" > 1200
		year > 3018
		has "First Contact: Hai: offered"
	on offer
		conversation
			`As you are making your way through the spaceport you notice a worried-looking Hai staring at the local job board and back at some sort of document they are holding.`
			choice
				`	(Approach the Hai.)`
				`	(Leave them alone.)`
					decline
			`	The Hai is a bit startled, but quickly calms down. "Sorry, you caught me by surprise. I've just bought my first ship and need to find some jobs to do, but nobody I've talked to wants to trust a beginner captain. I just don't know what to do anymore, I've been working for so long to qualify for this loan, but I'm running out of time and I'll never be able to pay it like this."`
			`	Turns out the documents she is holding are the bank papers for the loan, somewhat similar to the one you took when you bought your first ship. You've come a long way since your days as a beginner, and know how hard it is to be starting out as a starship captain; you could probably convince someone here to offer a simple cargo job to this young Hai.`
			choice
				`	"If you're interested, I could try to help you find a job."`
					goto "positive1"
				`	"I've been there before; trust me, it gets better. I wish you the best of luck on finding a job."`
			`	She nods in sad understanding, and continues to swap focus from the job board to the papers in her hand.`
			choice
				`	(Help her out anyway.)`
					goto "positive1"
				`	(Leave her alone and continue on.)`
					decline
			label "positive1"
			`	Her ears twitch a bit, and her previously crestfallen eyes light up as she nearly jumps in joy at your offer. "Thank you so much Captain! My name is Nanachi, I promise I won't cause any trouble at all, just a few quick jobs and I'm sure I'll be fine by myself!"`
			`	You introduce yourself to Nanachi and shake her paw. "Can you show me your ship so I can look for jobs it's best suited for?" you ask.`
			`	She hesitates a bit, but leads you to her ship. You were expecting a small Hai ship, but to your surprise she shows you a rather beat-up Heavy Shuttle docked near your own ship.`
			`	"You took a loan to buy a human ship?" you ask.`
			`	She looks at the ground, as if ashamed of it. "It'd take way too long for me to qualify for a loan for even an Aphid, but I recently met a human merchant who wanted to sell his old ship; it was difficult, but I managed to convince him to sell it to me instead of going to the shipyard office. I paid him its full price, but even for this one I had to take out the biggest loan I could. Its cargo hold isn't very impressive but it has more bunks than our smallest ships, if that helps."`
			choice
				`	"Let's see if anyone in the spaceport needs a lift off the planet."`
				`	"Let's take another look at the job board, maybe a smaller job will pop up."`
			`	Turns out this isn't as easy as you thought it'd be. The spaceport is almost empty, save for the occasional worker or drunken crewmember, and the job board is filled with massive hauls of minerals, aside from a few small but dangerous jobs to human space. Eventually, as you two begin scouting the edge of the docking area, you spot a troubled human merchant near several crates. You approach him and he explains that his ship had some malfunctions and he cannot deliver his cargo of advanced surgical equipment to <destination>. "This is the worst! One jump away from the planet and the navigation system suddenly decides to go on strike! There's no way I can make it before the deadline!"`
			`	"My friend Nanachi here could deliver it for you. We were heading there anyway; a few extra crates won't make a difference," you say, trying to sound as convincing as possible.`
			`	At first, he seems delighted that you two want to help him, but when Nanachi mentions that she's flying a Heavy Shuttle, he frowns, and looks back at the cargo. "Unfettered attacks make it so they need tons of medical supplies on <planet>, and quite frankly I'm not comfortable letting such a fragile ship go into dangerous territory carrying this equipment when it could be blasted to bits in an instant," he says. The captain glances around the deserted spaceport for a while, as if trying to find some other captain, before finally turning to Nanachi and saying, "but I guess beggars can't be choosers. Fine, I'll let you take the cargo there, but please be very careful."`
				accept
	npc accompany save
		personality escort timid
		government "Hai"
		ship "Heavy Shuttle" "Acorn Chaser"
	on visit
		dialog `You have reached <planet>, but you left Nanachi's ship behind! Better depart and wait for her to arrive in this star system.`
	on complete
		conversation
			`Shortly after her ship lands, you meet up with Nanachi, who is doing her best to hide her excitement at being on another planet for the first time, and is gawking at some Hai military ships in particular. "So, how did you like your first time doing a hyperspace jump?" you ask, to try and snap her out of it.`
			`	"Oh um, I don't think I'll get used to the feeling anytime soon. I threw up a lot so I'm glad this wasn't a job with passengers. I've always dreamt of being on other worlds, exploring and learning everything about them. I'm glad I'm finally able to do it."`
			`	You help her get the crates out of the cargo hold and contact the client. Nanachi's share of the payment is small, as the client transfers most of the money to the merchant she got the job from, but that doesn't make her any less excited about getting her first paycheck.`
			`	"So, want to go to the spaceport and try to get a job on your own? I'll help you again in case you can't do it yet." you say.`
			`	"Just give me an hour or two to explore. Back home our shipyard is kind of small. I've never really gotten a chance to see a Shield Beetle up close, and there are many undergoing repairs here. I'll just go get a better look at them, I swear I'll be quick."`
			`	You two agree to meet in the spaceport in a few hours; maybe this time she will do fine on her own.`



mission "Nanachi 2"
	name "Escort Nanachi to <planet>"
	description "Bring Nanachi and her passengers to <destination>."
	source "Cloudfire"
	destination "Hai-home"
	clearance
	to offer
		has "Nanachi 1: done"
	on offer
		conversation
			`You meet up with Nanachi in the spaceport, give her some tips to try and persuade someone into hiring her, and tell her you'll be nearby if she still has trouble getting a job. You watch her go around the spaceport and approach some groups of humans and even other Hai to no avail. Maybe since this is a world seeing combat often, they're too busy with military related activities to help a new pilot. She manages to grab the attention of a Hai family leaving a restaurant carrying way too much luggage, most likely tourists looking for a ride back home. Everything seems to be going well until the parents start to look worried. It seems as if they might go away if you don't step in.`
			`	You walk over to the group to help her, and get a better look at the family: a Hai couple carrying a baby, and three older children who aren't doing much to help their father carry their ludicrous number of bags.`
			choice
				`	"Hey, what's going on?"`
				`	"Can I be of assistance?"`
			`	You introduce yourself and the parents tell you that they've been on vacation here and need transport back to <destination>. "Don't take this the wrong way, but Captain Nanachi told us her ship is one of your human ships, a Heavy Shuttle was it? It has enough bunks for us but our sons already caused a ruckus on the way here in a Hai ship, we're worried that since they aren't used to the accommodations, they might end up giving her too much trouble."`
			`	You reassure them that the trip will be very quick, and that the ship's interior is somewhat similar to that of Hai ships, until they finally agree on traveling with her. They settle on the pay and the two of you help the Hai get their baggage to Nanachi's ship. When the family is focused on a conversation, you quietly ask Nanachi what the issue she was having with the other people she encountered.`
			`	"They all seemed willing to give me a job, but I ended up blowing it when I asked for more money. I just really need to get out of debt so I guess I went a bit overboard." She tries to play it cool, but it's clear that she is embarrassed about losing so many potential jobs. When you reach her ship, you take a look at the prices for commodities in <system>. You decide to tell Nanachi to stock up on heavy metals to sell there, to help her make a bit more profit.`
				accept
	npc accompany save
		personality escort timid
		government "Hai"
		ship "Heavy Shuttle" "Acorn Chaser"
	on visit
		dialog `You have reached <planet>, but you left Nanachi's ship behind! Better depart and wait for her to arrive in this star system.`
	on complete
		conversation
			`You help the family gather all their luggage and bid them farewell, but right as they disappear into a hallway Nanachi lets out a heavy sigh. "I bit off more than I could chew. Those kids kept wanting to play with the ship's controls, and one of them tried to go up the air vent in a game of hide-and-seek. I couldn't get any rest since I had to keep making sure they weren't about to dump their own bags into the void by accident."`
			`	"Do you want to get some sleep before trying to find another mission?" you ask, hoping she won't try to overwork herself.`
			`	"Yes, I could really use that. Sorry to make you wait again Captain <last>. I'll rest a bit, see if I can't find a spot nearby to relax, and meet up with you in the spaceport after a while."`



mission "Nanachi 3"
	name "Deliver spices with Nanachi"
	description "Accompany Nanachi to <stopovers> to pick up some Quarg spices for a festival on <destination> by <date>."
	source "Hai-home"
	stopover "Alta Hai"
	destination "Allhome"
	deadline 14
	to offer
		has "Nanachi 2: done"
	on offer
		conversation
			`You send a message to Nanachi and you two meet up in the spaceport. You're still walking toward the job board, when she asks: "Back home I heard stories about how humans have a much larger population than the Hai, and that their home planet has even more people than Hai-home. Is it true that there are many other human worlds with spaceports this large?" You name her a few human planets that are extremely populous, and how even some planets with fewer people than this world have incredibly large spaceports.`
			`	While you tell her stories of many different planets you've visited, she seems to be particularly interested in Earth. "I've seen a bit of human architecture in videos of planets like Allhome, but I can't even imagine what your capital must look like. Tens of thousands of years of another species' history, it sounds even more exciting than what I heard about our landmarks on Hai-home. Captain, do you think that someday, when we no longer need to be kept hidden from humanity, that I'll be able to visit Earth, and see the beauty of your capital?" Seeing how little she knows about humanity, it's not surprising that she is unaware of the state that Earth is in.`
			choice
				`	"I've never actually been to Earth before, so I couldn't tell you what it's like."`
					goto avoid
				`	"Earth is a beautiful place, so it would be nice if you could see it."`
					goto fake
				`	"Earth isn't actually that great a place to visit. Most of its inhabitants would take any chance they're given to leave it."`
					goto truth
			label avoid
			`	"Oh, sorry about that, shouldn't have assumed you knew everything, you're a starship captain after all, not a historian, I'll just ask someone else when I get the chance," says Nanachi.`
					goto board
			label fake
			`	You start making up stories about how beautiful the skies of Earth are. You describe forests teeming with life, and do your best to remember ancient civilizations and their monuments. From the looks of it she believes you, and your lie seems to have sated her curiosity for now. If the day where the Hai are allowed to move around human space ever comes, though, she will no doubt be extremely disappointed.`
					goto board
			label truth
			`	She looks at you in confusion, as if trying to understand what you mean, so you explain it to her. "Despite how much humanity has advanced in the past centuries, Earth has been largely neglected. Most of the land has been turned into cities, which have over the years decayed into slums. If you ever managed to visit you'd be better off going to museums or monuments, but even then there are many thieves roaming the streets and it is very dangerous to be out at night. Lots of folks born there just think about how to get out."`
			`	You keep telling her about the issues facing humanity's birthplace, and her previous eagerness to learn about the planet fades. "How could your ancestors let their own home become like this?"`
			branch unfettered
				has "Ask the Hai about the Unfettered: offered"
			choice
				`	"Long-term planning has never been a strong trait of humanity as a whole."`
					goto end
			
			label unfettered
			choice
				`	"I guess it isn't too unlike how the Unfettered have treated their worlds."`
			`	Nanachi looks confused, so you continue to elaborate on that idea. "They're expecting to be able to have new worlds soon, so they consider the decay of their current ones as acceptable losses. Humans have also had issues with long-term planning and preparing for adverse events."`
					goto end
			label end
			`	"I see..." She says. "I just thought it would be fun to hear about another large planet like Hai-Home. Sorry for asking about it, Captain, I'm sure having to speak of it wasn't a pleasant feeling."`
			`	Although you're sure that even in Hai space there is social inequality, she probably can't fathom that the home planet of a species could be in such bad shape, considering the Hai even go as far as to send aid to the Unfettered on a regular basis.`
					goto board
			label board
			`	You two reach the job board and decide to start looking for jobs suited for Nanachi's ship.`
			choice
				`	"So, do you mind if I help out? I know the job board can be confusing the first few times you check it."`
				`	"Do you think you need me to help out this time?"`
			`	"Thanks, but I have to do this on my own. I promise I won't mess this up by getting greedy again," She approaches the board on her own, and it becomes clear that it's much easier to get a job here; she's barely started talking to one of the desk workers before receiving a long list of jobs for smaller ships. She is certainly still very tired, but this seems to have cheered her up a bit; it is the first time she can get a job without your help after all.`
			`	While you thought she would've picked one or two jobs quickly and headed back to her ship, she keeps going through them and double checking the information for each one, as if something about them bothers her.`
			`	"What's wrong? Are you struggling to pick between two different jobs?" you ask.`
			`	"These all seem very easy and I could even accept many at a time, but the problem is their pay isn't very good." She grabs some worn papers from her pocket, and shows it to you: they're the documents for her loan. "The bank back home would only give me enough for the ship if I agreed on a short-term loan. I lost two days before you came along to help me, and if I don't get some better paying job soon, I won't even be able to pay the interest."`
			`	As you're trying to figure out a way to get the most out of the available missions, you feel a tap on your shoulder, and turn to see a Hai standing beside a human couple. The couple introduce themselves as Xavier and Vanessa, who are here with their Hai friend Narancia. "We overheard your conversation and are willing to pay a little extra for a job. We're part of a group organizing a big festival in Allhome to celebrate the friendship between humans and Hai, and we just got a last-minute idea: we'd like to get our hands on some Quarg spices."`
			`	Nanachi perks up during their conversation. "I'm sure I can get the spices to <planet> within two weeks. I won't let you down!"`
			`	"That's wonderful," Narancia says. They tell Nanachi that they won't be going along; they already have a transport to Allhome, and will stay here a bit longer to try and advertise the event. "Just come to Allhome after you've picked up the spices. Safe travels!"`
				accept
	on stopover
		dialog
			`A spaceport worker contacted Nanachi shortly before you two landed and made sure the spices were ready to be loaded in her ship. You help the workers and Nanachi make sure everything is in order, and prepare for your trip to Allhome.`
	npc accompany save
		personality escort timid
		government "Hai"
		ship "Heavy Shuttle" "Acorn Chaser"
	on visit
		dialog `You have reached <planet>, but you left Nanachi's ship behind! Better depart and wait for them to arrive in this star system.`
	on complete
		conversation
			`Allhome's docking area shows much more traffic than usual. Many captains here are helping workers open cargo containers full of food, clothes, books, movies and even some mounted animals from human space. You finally meet up with the festival's organizers, who seem very excited to have acquired the exotic condiments, and have invited you two to a bar in the spaceport for a drink.`



mission "Nanachi 4"
	name "Protect Nanachi"
	description "Bring Nanachi's ship to <stopovers>, keeping her safe from a pirate fleet that attacked a convoy heading to Hai space, then head back to <destination> by <date>."
	source "Allhome"
	stopover "Prime"
	deadline 17
	to offer
		has "Nanachi 3: done"
	on offer
		conversation
			`The bar is just as busy as the docks. Many captains here must have transported something for the festival. "Captain <last>, Captain Nanachi!" shouts Narancia, beckoning the two of you to join her and the others at their table. You learn that they were inspired by the Hai's own March festival, and wanted to bring small parts of human culture to Hai space.`
			`	"They can't go to our planets and experience it for themselves yet, so we thought about bringing it to them!" Vanessa says.`
			`	"It was very hard to get enough sponsors for this, but after years of hard work we even managed to have famous art pieces be brought here, some of which date back to the European Renaissance!" Xavier adds.`
			`	Afterwards the conversation topic shifts to you as a captain, as you describe your journey after buying your first ship, and how you met Nanachi. You're about to order another drink for the group when a grizzled old man barges into the bar, and starts shouting: "The art convoy has been attacked! The freighter managed to escape but they're stranded on Prime now, and the pirates are still out there, patrolling the route to the wormhole!"`
			`	Xavier stands up with a shocked expression. "How? We had a Leviathan escorting them!"`
			`	After catching his breath, the man at the door responds. "The pirates must have been stealing Hai tech from ships going back home. The freighter's captain said they shredded the escort!" Chaos spreads amongst the other captains, and the group sitting with you is in anguish.`
			choice
				`	"Are those art pieces really that valuable?"`
				`	"Can't you just postpone the festival until the pirates are taken care of?"`
			`	Xavier collapses back to the table, holding his head in both hands. "Those paintings and sculptures were our main attraction! They're worth tens of billions! It'll take months before the Navy ever notices the pirates there and makes it safe for the convoy to come here. The art exhibition is scheduled three weeks from now!"`
			`	As they try to figure out what to do, Nanachi speaks up. "I'll go there. I pilot a human ship and if we just need to transfer cargo from one ship to the other, I could get out of there quickly. Nobody would notice that a Hai ever went there."`
			`	"Are you insane?" Vanessa says, "If they managed to take down that Leviathan, you wouldn't last a second! Besides, our convoy was extremely fast. If even they were caught your chances of outrunning the pirates are next to nothing!"`
			`	"Captain <last>," Nanachi turns to you. "I know you already helped me way more than anyone would ever be willing to, and I'm really grateful for that, but would you be willing to help me one last time, to get to that planet, and travel back here?" While it's certain that for a pirate fleet to take down a Leviathan so easily they must be incredibly powerful, and this could be extremely dangerous. You're sure that if Nanachi tries to get to Prime by herself she'll just get herself killed.`
			choice
				`	"Alright, I'll make sure we reach Prime and get back here safely."`
				`	"No, I agreed to help you find and deal with some simple jobs, but I can't risk fighting such a fleet by myself."`
					decline
			`	She thanks you profusely, and promises that she'll pay you for everything as soon as she can. The organizers are a bit hesitant, but seeing as no other captain here has decided to offer them help, they agree to let the two of you go to Prime and retrieve the cargo.`
			`	Vanessa grabs ahold of Nanachi's arm before she can run off to the spaceport. "Just remember, if you can't get back here by <day>, don't worry about it; we'll understand. I'm sure we can come up with some alternative to have the festival without our main attractions."`
			`	As you're leaving the bar, Xavier pulls you aside, speaking very quietly, "<last>, I know you're just trying to help this girl, but don't get killed over this. If you run into those pirates don't try to fight them, just rush to Prime."`
				accept
	npc
		personality nemesis waiting
		government "Pirate"
		system "Betelgeuse"
		ship "Marauder Firebird (Hai)" "Nut King Call"
		ship "Marauder Splinter (Hai)" "The Nutcracker"
		ship "Marauder Quicksilver (Hai)" "Hazelnut's Bane"
		ship "Marauder Bounder (Hai)" "Rodent Hunter"
	npc accompany save
		personality escort timid
		government "Hai (Wormhole Access)"
		ship "Heavy Shuttle" "Acorn Chaser"
	on visit
		dialog `You have reached <planet>, but you left Nanachi's ship behind! Better depart and wait for them to arrive in this star system.`
	on stopover
		conversation
			`The convoy's captain messaged you as you entered the system and told you to land on a remote, hidden area of Prime, where they have already prepared for all the cargo to be transferred. They refuel your ships and urge you two to go back. "Captain Nanachi can stay hidden with us here if you need supplies or anything from the outfitter, but please don't take too long."`
	on complete
		event "Nanachi: payment" 180
		log "Minor People" "Nanachi" `A young Hai merchant captain who struggled in the beginning of her career. Her fortune turned when she was able, against difficult circumstances, to deliver a valuable collection of human arts on time to the organizers of a Hai festival.`
		conversation
			`Landing back on Allhome, the festival group gives you and Nanachi a warm hug, "We sold tens of thousands of tickets for the festival by promising to host a great art exhibition with pieces from all over human space. Without them it'd be a complete failure, and we'd be in serious trouble with our sponsors." Narancia explains.`
			`	As the cargo is rushed to the exhibition site, Nanachi shows you the chip she got as payment, and the balance of her bank account: this last payment allowed her to fully pay off her loan. "Captain," she speaks with some difficulty, and tries to hide her face, as if to wipe away some tears. "I'll never be able to thank you properly, if not for you I'd still be lost in that spaceport, and would eventually have to go back to my mining job. I'll work hard now; I'll save up and pay you for everything!" She hugs you and bows to you in a way you'd see in movies, as if trying to imitate the gesture. You two finally say goodbye, and head back to your ships.`

event "Nanachi: payment"



mission "Nanachi: Payment"
	landing
	source
		government "Hai"
		not planet "Darkwaste"
	to offer
		has "event: Nanachi: payment"
	on offer
		payment 700000
		event "Nanachi: Update" 720
		conversation
			`Shortly after you land, you get a message from Nanachi, the young Hai pilot who you helped start out. "Dear Captain <last>, I hope you're doing well! As I promised, ever since we parted ways, I've been working towards getting enough money to pay you for being so kind to help me. I've sent you <payment>. I'm deeply grateful to you for helping make my dream come true."`
				decline

event "Nanachi: Update"



mission "Nanachi Meeting"
	landing
	source
		government "Hai"
		not planet "Darkwaste"
	to offer
		has "event: Nanachi: Update"
		random > 30
	on offer
		conversation
			`After you leave your ship and start making your way through the docking area, you notice a Hai running towards you and waving. As they get closer, you realize that it's Nanachi, the Hai pilot who you helped out years ago.`
			`	"I was just about to go back to my crew when I saw you coming out of your ship. I know a nice snack bar here, let's go there!" Before you can even say hello, she's dragged you to the bar, and ordered some drinks for the two of you. She tells you about her last few years as a captain. She has long since sold her old ship, and now pilots a Geocoris, transporting large amounts of cargo across Hai space. You also tell her about how your life has been ever since you last met, of your adventures and how far you've come. You keep swapping stories for hours, until the bar is ready to close.`
			`	You thank her for the drinks, and get ready to say your goodbyes.`
			`	"Oh wait, before you go Captain, let me give you something," she says, right as you're about to head to your ship. She grabs a small pendant from her pocket. "Back home in Giverstone, when I had some free time from the mining works, I took a hobby of sculpting some small stones into ship miniatures. I thought it'd be nice to make this for you in case I saw you again." She gives you the pendant, which has been sculpted into a Hai Shield Beetle. It is extremely well made, with different surface textures representing the different parts of the Shield Beetle. "It's just a good-luck charm I thought you'd like. Thanks again Captain!" You two part ways, and head back to your ships.`
				decline



mission "Strider Alt Start"
	landing
	name "New Unfettered ships"
	description "Ambassador Sayari has informed the council of elders of the development of the Solifuge. The council is interested in meeting with you on <destination> to hear more."
	source
		government "Hai"
		not planet "Hai-home"
	destination "Hai-home"
	clearance
	to offer
		has "Wanderers Evacuation 1: offered"
		not "Wanderers Solifuge Recon 3: offered"
		or
			has "Wanderers Solifuge Recon 2: done"
			has "Wanderers Pond Strider Recon 2: done"
	on offer
		dialog `After you finish landing, you're approached by a Hai in a formal uniform. "Greetings, Captain <last>. Ambassador Sayari has sent word to the council of elders that our Unfettered brethren have created a new ship of great strength. The council has requested your presence on <planet>; Sayari said you have been in combat with these ships, and the elders are interested in your expertise."`
	on complete
		conversation "solifuge conversation"



mission "Strider 0"
	landing
	name "Hull Repair Technology"
	description "The Hai are working on a drone carrier to counter the Unfettered Solifuge, but the creator of the ship is still developing hull repair to make it more effective in combat. Visit the spaceport on <planet> to help the Hai with this technology when you are able."
	destination "Hai-home"
	to offer
		or
			has "Wanderers Solifuge Recon 3: done"
			has "Strider Alt Start: done"
	to fail
		has "Strider 1: offered"
	to complete
		never



mission "Strider 1"
	landing
	name "Hull Repair Technology"
	description "The Hai are working on a drone carrier to counter the Unfettered Solifuge, but the creator of the ship is still developing hull repair to make it more effective in combat. Visit the spaceport on <planet> to help the Hai with this technology when you are able."
	source "Hai-home"
	to offer
		has "Strider 0: active"
	on offer
		conversation
			branch "know both"
				has "license: Remnant"
				has "license: Coalition"
			
			branch "know coalition"
				has "license: Coalition"
			
			branch "know remnant"
				has "license: Remnant"
			
			`You've returned to <planet>, but you don't have access to any hull repair technology. Explore the galaxy and earn the trust of an alien faction that has hull repair technology before returning.`
				defer
			
			label "know both"
			`You've returned to <planet> to help the Hai to develop hull repair technology. Osen's father asked if you knew of any aliens with hull repair technology, and you have met the Coalition, who have outfits capable of repairing hulls, and the Remnant, who have ships that repair themselves. Would you like to tell the elders about one of these groups?`
			choice
				`	(Yes.)`
					goto start
				`	(Not right now.)`
					defer
			
			label "know coalition"
			`You've returned to <planet> to help the Hai to develop hull repair technology. Osen's father asked if you knew of any aliens with hull repair technology, and you have met the Coalition, who have outfits capable of repairing hulls. Would you like to tell the elders about the Coalition?`
			choice
				`	(Yes.)`
					goto start
				`	(Not right now.)`
					defer
			
			label "know remnant"
			`You've returned to <planet> to help the Hai to develop hull repair technology. Osen's father asked if you knew of any aliens with hull repair technology, and you have met the Remnant, who have ships that repair themselves. Would you like to tell the elders about the Remnant?`
			choice
				`	(Yes.)`
				`	(Not right now.)`
					defer
			
			label start
			`	You inform the elders that you have discovered a group that could help them with creating hull repair technology, and they invite you to the council chamber. "Greetings, Captain <last>," one of the elders says to you upon entering the chamber. "What news do you have to bring us on your search for hull repair technology?"`
			branch "tell both"
				has "license: Remnant"
				has "license: Coalition"
			
			branch "tell remnant"
				has "license: Remnant"
			
			branch "tell coalition"
				has "license: Coalition"
			
			label "tell both"
			choice
				`	"There is a group of three alien species far from here known as the Coalition that have outfits able to repair a ship in flight."`
					goto coalition
				`	"There is a group of humans far from here known as the Remnant who have ships that can repair themselves."`
					goto remnant
			
			label "tell remnant"
			choice
				`	"There is a group of humans far from here known as the Remnant who have ships that can repair themselves."`
					goto remnant
			
			label "tell coalition"
			choice
				`	"There is a group of three alien species far from here known as the Coalition that have outfits able to repair a ship in flight."`
					goto coalition
			
			label remnant
			apply
				set "strider: remnant"
			`	"A group of humans with hull repair technology?" one of the elders asks with a puzzled look. "I am surprised that we have not heard of these humans before. Are they well known among the Republic?"`
			`	"No," you explain. "They are a reclusive group unknown to most of humanity. They likely wouldn't take kindly to being visited by aliens."`
				goto end
			
			label coalition
			apply
				set "strider: coalition"
			`	"A group of three aliens?" one of the elders asks with a puzzled look. "It is not often in the galaxy that such groups appear."`
			
			label end
			`	"We will put together a delegation for you to transport to these people you mention. They will be waiting in the spaceport shortly," another elder says. "You may lead them to make contact with this group how you see fit. We trust that you will be capable in doing so."`
				decline



mission "Strider: Remnant 1"
	name "Contact the Remnant"
	description "Take a message from the Hai to <stopovers> to set up a meeting between the Remnant and the Hai, then return to <destination>."
	source "Hai-home"
	stopover "Viminal"
	to offer
		has "strider: remnant"
	on offer
		conversation
			`You enter the spaceport and find the Hai delegation meant to travel to the Remnant to negotiate for the hull repair technology. The leader of the delegation introduces herself as Ambassador Yashili. "I heard that we will be travelling a great distance across the galaxy. May we have a safe journey."`
			`	The delegation begins making their way to your ship, but you stop them.`
			choice
				`	"Wait a minute! This group doesn't react well to strangers. How about I set up a meeting first?"`
				`	"Not so fast. The Remnant value their secrecy, and I haven't spoken to them about this situation. Let me set up a meeting first."`
			`	The Hai look at each other and chatter quietly among themselves, then Ambassador Yashili speaks up. "You know this group, and how to make the best impression on them." She pauses to whisper to another Hai, who runs off. The Ambassador turns back to you. "I will provide you with a letter that will include a brief introduction of the Hai, an explanation of why we would like to meet them, and an invitation to establish diplomatic relations."`
			`	Moments later, the Hai who ran off returns carrying a sealed envelope and hands it to the Ambassador. She turns to you. "Here it is. Please take this to these reclusive humans for us. We will be waiting here for your return."`
			`	"Will do," you respond after taking the envelope. The delegation says its goodbyes, wishing you safe travels, before leaving.`
				accept
	on stopover
		conversation
			`Looking around the spaceport, you are not sure who to talk to about such a diplomatic request. Eventually, you go to the starport information desk to ask them. You hand the letter to the person at the desk, and after reading it, they invite you to wait in the cafeteria while they look for someone who can fulfill the request from the Hai.`
			`	After an hour of watching Remnant eating and gesturing to each other, an androgynous Remnant approaches your table. You try to guess what age they are, but while they do not seem young, neither do they seem particularly old.`
			`	"Greetings, Captain <first>," The stranger signs. "My name is Rayn, and my colleague said you had a request from another faction. It is my understanding that they desire the means to repair the hull of a ship in flight. Is this correct?"`
			choice
				`	"Yes. The Hai are hoping to be able to improve a new carrier they are developing to repair its drones."`
				`	"Yes. The Hai want to be able to repair the hulls of their ships to gain an edge against their enemies."`
			`	"So the Hai want to improve their military technology? I presume this is in response to their long-standing war against the Unfettered?"`
			choice
				`	"Yes, although they don't think of it as such."`
				`	"It isn't a war; it's a defensive action."`
			`	Rayn looks amused. "It does not matter what they call it. A war by any name is just as bloody. But that aside, how do they know about us to make such a request?"`
			choice
				`	"They were looking for someone who had repair technology, and I said I could find someone."`
				`	"They asked if I knew anyone who had in-flight repair technology, and I said I knew a group of human researchers."`
			`	"So they do not actually know about us. That is good." Rayn looks thoughtful and closes their eyes for a moment, then continues. "Pick up the Hai diplomats, but do not tell them where you are going. Take them to these coordinates on Covert in the Gienah system. It is a location in an uninhabited area where we will be able to talk. We will be waiting with something that might be able to help them - if they can meet our price."`



mission "Strider: Remnant 2"
	landing
	name "Meet with the Remnant"
	description "Transport Ambassador Yashili and her delegation to <destination> to attempt to obtain hull repair technology from the Remnant."
	source "Hai-home"
	destination "Covert"
	infiltrating
	passengers 3
	blocked "The Hai are sending a delegation to <destination> and will require 3 bunks for the trip."
	to offer
		has "Strider: Remnant 1: done"
	on offer
		conversation
			`You message Ambassador Yashili and tell her that you have arranged a meeting with the Remnant. "This is good news. We will be meeting with you in the spaceport shortly."`
			`	Some time later the delegation arrives at your ship. "Before we leave, is there anything we need to know about this group before we meet them?" Yashili asks.`
			choice
				`	"The Remnant are a group of humans, so there isn't anything special you should need to know."`
					goto end
				`	"The Remnant agreed to meet you on <planet>, a dangerous pirate world, so don't stray too far from the ship."`
			`	"Oh," Yashili exclaims with a surprised look. "Are these Remnant also dangerous people?"`
			`	"No, they're friendly people," you reassure her. "They just don't want to meet in their own territory."`
			label end
			`	The delegation thanks you for this information and boards your ship. You plot a course for <destination>. Hopefully, the Remnant will be willing to share with an alien species they just met.`
				accept
	on visit
		dialog `It appears that the delegation is bunked on escorts that have not arrived in this system yet. Take off and wait for them.`



mission "Strider: Remnant 3"
	landing
	name "Technology Obtained"
	description "The delegation has successfully obtained hull repair technology from the Remnant. Return to <destination> so that the Hai can begin developing this technology for their new ship."
	landing
	source "Covert"
	destination "Hai-home"
	passengers 3
	cargo "repair technology" 12
	blocked "You need <capacity> in order to return the Hai delegation and the repair technology back to <planet>."
	to offer
		has "Strider: Remnant 2: done"
	on offer
		log `Helped the Hai get in contact with the Remnant in order to learn how to create in-flight hull repair technology. The Hai obtained a copy of the Remnant's research on Korath systems cores, along with a number of samples.`
		conversation
			`At the designated coordinates, there is a small encampment set up that looks vaguely reminiscent of a desert trader outpost. Aside from a few camels tied near a water trough, the place looks abandoned. When you touch down next to it, the delegation steps out cautiously. "Is this the right place?" one of the Hai asks somewhat worriedly.`
			`	Before you can answer, a number of Remnant emerge from the tents, and you notice that Rayn is among them. "Welcome to our encampment, representatives," Rayn chants. "Captain <first> brought us your missive, and we asked them to bring you here. Would you care to come inside?" They gesture toward the largest of the tents. While obviously surprised, Ambassador Yashili acquiesces, and the Hai step inside. Rayn gestures for you to follow. The remaining Remnant begin patrolling around the camp.`
			`	Rayn offers food and water to the Hai and then takes a seat on a cushion on the ground. The Hai politely refuse the food before joining Rayn on the cushions. Ambassador Yashili begins. "We come representing the Hai people, who live far from here. Some of our brothers and sisters have turned violent toward us, and have recently created a new ship that may cause us trouble. We have created a ship of our own in retaliation, but we are still in need of technology capable of repairing the hull of a ship while in flight so that we may have an advantage. Captain <last> has told us that you have such technology, with ship hulls that repair themselves."`
			`	"It is true that our ships self repair," Rayn responds. "But this is not technology that we are able to share. The property is intrinsic to the metals that we build our ships with - metals which are in low supply." Yashili looks concerned with this development; perhaps this journey was a worthless one.`
			choice
				`	"So is there no way that you can help them?"`
				`	"There must be something we could do."`
			`	"Do not fear, for we have something else. For many decades, we have been fighting and plundering Korath raiders from the Core. Their ships contain outfits capable of hull repair through the use of small robots. We have been unable to reproduce these robots with ease, but we may be able to provide for you our research and a number of samples that you may use."`
			`	"We too have encountered these Korath," Yashili says in response. "Although, we had not taken their technology. This may be of great use to us."`
			`	"We would like to ask something in trade, however: a copy of your astronomical records. The history of the galaxy itself is a mystery to us, and we would like to learn more about it."`
			`	Ambassador Yashili looks thoughtful, then nods. "Historical astronomical data is scientifically valuable, as is learning how to repair our ships in flight. This seems a fair trade. We should be able to have the data for you shortly. We only need use of Captain <first>'s ship to access the hyperspace communiation relays." Yashili nods to another member of the delegation, who then scurries off to your ship.`
			`	"I imagine there will be a large amount of data to transfer," Rayn says. "Let us pass the time."`
			`	Ambassador Yashili and Rayn settle into diplomatic small talk. The conversational dance between a group of professional diplomats and a secretive group that are currently playing the role of nomadic desert traders is an odd one.`
			`	"While we wait, I am curious how you met these Remnant, Captain," Yashili says.`
			choice
				`	"I spend much of my time exploring the galaxy. Sometimes you stumble upon interesting things."`
				`	"Well, the same way I'd imagine most people found you - by just wandering aimlessly."`
			`	Yashili nods. "This is an understandable situation."`
			``	
			`	An hour of conversation later, the Ambassador's assistant returns with a large data drive and hands it to her. The Remnant pull out a data chip of their own, and the two groups formally exchange the data. In response to an unseen signal, another Remnant pulls back one side of the tent, and a team carries in a segment from a systems core with several of the small robots. "There are more of these waiting outside, but here is a sample for you to inspect. Using the instructions we have provided, you should have no problem making use of this technology." They poke at the console, and the robots promptly spring to life and assemble a small pile of parts into a model ship.`
			`	"Thank you for doing business with us," says Ambassador Yashili. "You have a friend in the Hai." She bows and the Remnant return the bow with fluid grace before quickly shouldering the Korath equipment. They load everything onto the <ship> as the delegation boards, and you set out to return to <planet>.`
			`	As you take off, a final glance at your exterior cameras shows the Remnant have already almost finished packing up their encampment onto the camels. As one tent comes down, it reveals a anti-aircraft artillery cannon installed on a sled. Despite the rustic appearance they portrayed, the Remnant certainly took their security seriously. There is still no ship visible, but you suspect that a Starling or Gull is undoubtedly hiding nearby.`
				accept



mission "Strider: Coalition 1"
	name "Contact the Coalition"
	description "Transport Ambassador Yashili and her delegation to <destination> to attempt to obtain hull repair technology from the Coalition."
	source "Hai-home"
	destination "Ring of Friendship"
	passengers 3
	blocked "The Hai are sending a delegation to <destination> and will require 3 bunks for the trip."
	to offer
		has "strider: coalition"
	on offer
		conversation
			`You enter the spaceport and find the Hai delegation meant to travel to the Coalition to negotiate for the hull repair technology. The leader of the delegation introduces herself as Ambassador Yashili. "I heard that we will be traveling a great distance across the galaxy. May we have a safe journey."`
			`	"Is there anything that we should know about this Coalition before meeting them?" another member of the delegation asks.`
			choice
				`	"The Coalition are a group of three species that live in harmony, just like the humans and Hai here. They should enjoy meeting new aliens."`
					goto normal
				`	"The Coalition hate the Quarg and went to war with them many millennia ago in order to drive them out of their space."`
			`	"That is most concerning," Yashili says with nods of agreement from the other two members of the delegation. "Hopefully the presence of the Quarg in Hai space will be of no issue to them." Yashili thinks for a moment. "Or perhaps we could use this information to our advantage."`
			label normal
			`	The delegation gathers their things and boards your ship, and you plot a course for <destination>. Hopefully the Coalition will be willing to share with an alien species they just met.`
				accept
	on visit
		dialog `It appears that the delegation is bunked on escorts that have not arrived in this system yet. Take off and wait for them.`



mission "Strider: Coalition 2"
	landing
	name "Technology Obtained"
	description "The delegation has successfully obtained hull repair technology from the Coalition. Return to <destination> so that the Hai can begin developing this technology for their new ship."
	source "Ring of Friendship"
	destination "Hai-home"
	passengers 3
	cargo "repair technology" 12
	blocked "You need <capacity> in order to return the Hai delegation and the repair technology back to <planet>."
	to offer
		has "Strider: Coalition 1: done"
	on offer
		log `Helped the Hai get in contact with the Coalition in order to learn how to create in-flight hull repair technology. The Hai obtained a schematic of the Coalition's repair modules, along with a number of samples.`
		conversation
			`Before landing, you notify the Heliarch that you're bringing alien ambassadors to meet with them, and sure enough a Heliarch delegation is waiting for you when you land. They briefly salute you, but appear to be much more interested in the strange new beings you've brought to their center of government.`
			`	The Hai delegation is momentarily confused by the unusual speech pattern the Coalition species have, but snap out of it shortly. The Heliarch then start explaining their story to the Hai, the same they told you when you first met them, including their warning about the Quarg. While both delegations are engaged in conversation, a Heliarch agent approaches you, asking, "To this precious encounter, with what purpose have you brought these people, Captain?"`
			choice
				`	"They're in need of your help."`
				`	"They come seeking technology."`
			`	You start talking to them about the Hai and their conflict with the Unfettered, but as you're explaining you hear a loud collective gasp coming from the Heliarchs that are conversing with the Hai. A member of the Heliarch delegation approaches you. "Captain <last>, kindly telling us about their territory and society, your friend Yashili has. Truthful, is it, that close to the Hai planets, a ringworld the Quarg have constructed?"`
			`	The others seem to be in an excited conversation of their own, after changing their translation devices to no longer speak human. Yashili and the other Hai also turn to you, looking somewhat confused, waiting for you to respond for them.`
			choice
				`	"The Quarg are indeed there, but they stay out of Hai business, and the Hai stay out of theirs."`
					goto business
				`	"Yes, the Quarg have a single system there with a complete ringworld, where many Hai and even some humans also live."`
			`	The Heliarchs speak among themselves at a rapid pace, and before you know it several dozen other agents are around. One of them, an older Saryd with a golden circlet, says, "Tell us more about this ringworld, you must, Hai friends. Accompany us, would you?"`
			`	Without waiting for the Hai delegation to answer, they practically drag them to a restricted section of the ringworld without you. About an hour later, the Hai are brought back, most with tired expressions.`
			`	"Had I known we would be interrogated on the engineering aspects and the inner workings of a ringworld, I would have had an engineer come with us," Yashili whispers to you.`
			
			label business
			`	The Heliarchs once again warn the Hai to be careful with the Quarg before finally letting the Hai explain the reason for their trip here.`
			`	The delegation still looks a bit overwhelmed, as if still processing all the history the Heliarch just told them, but Yashili has kept her composure and begins speaking. "We come representing the Hai people, who live far from here. Some of our brothers and sisters have turned violent toward us, and have recently created a new ship that may cause us trouble. We have created a ship of our own in retaliation, but we are still in need of technology capable of repairing the hull of a ship while in flight so that we may have an advantage. Captain <last> has told us that you possess such technology."`
			`	"Developed such technology, indeed we have," an Arach agent responds. "Composed of several dozens of small repair bots, and their center of command, such outfits are."`
			choice
				`	"So are you willing to give or sell one of those outfits to the Hai?"`
				`	"Would you share the way of mass producing those outfits with the Hai?"`
			`	"Much involved in projecting our repair modules, House Chamgar is," the same Arach says. "Contact their representatives in this ring, we will."`
			`	"Do you desire anything in return?" Yashili asks the agent.`
			`	"In return, we ask nothing. Helping you extend beyond the limits placed upon you by the Quarg, enough of a reward is," the Arach responds. Yashili looks somewhat puzzled, but does not press the issue any further.`
			`	A short time later, a group of Arachi representing House Chamgar arrive. They have the Hai describe their ships, using this information to optimize the repair module for Hai ships. They then prepare a copy of the blueprints, handing a data chip containing the schematics for the hull repair modules and their hull-walking robots to the Hai. Some workers then load a crate with two small modules onto your ship for the Hai to use as examples. Yashili thanks the Coalition for their generosity and boards your ship, ready to return to <destination>.`
				accept



event "pond strider mass production"
	shipyard "Hai Basics"
		"Flea"
	shipyard "Hai Advanced"
		"Pond Strider"
		"Flea"
	outfitter "Hai Basic"
		"Railgun Slug"
	outfitter "Hai Intermediate"
		"Railgun"
		"Railgun Slug"
		"Railgun Slug Rack"
		`"Baellie" Atomic Engines`
	outfitter "Hai Advanced"
		"Railgun"
		"Railgun Slug"
		"Railgun Slug Rack"
		`"Baellie" Atomic Engines`
	fleet "Large Hai"
		add variant 1
			"Geocoris"
			"Pond Strider (Tracker)"
			"Pond Strider (Railgun)"
			"Flea" 16
		add variant 1
			"Shield Beetle (Tracker)"
			"Pond Strider (Tracker)"
			"Flea" 8
			"Lightning Bug" 2
		add variant 1
			"Pond Strider"
			"Flea (Pulse)" 8
			"Lightning Bug" 2
			"Water Bug" 2
		add variant 2
			"Pond Strider (Ion)" 2
			"Flea" 16
		add variant 2
			"Pond Strider"
			"Flea" 8
			"Centipede" 2
		add variant 3
			"Shield Beetle (Pulse)"
			"Pond Strider (Pulse)"
			"Flea (Pulse)" 8

mission "Strider 3"
	landing
	source "Hai-home"
	to offer
		or
			has "Strider: Coalition 2: done"
			has "Strider: Remnant 3: done"
	on offer
		event "pond strider mass production" 30 90
		conversation
			`Yashili contacts the elders as you land, informing them that you have obtained the hull repair technology. They agree to meet you in the spaceport along with Osen. A group of spaceport workers begins unloading the samples from your cargo bay after you land.`
			`	As you depart your ship, you spot the Hai elders and Osen approaching. Ambassador Yashili and the Hai delegation step forward to meet them.`
			branch coalition
				has "Strider: Coalition 2: done"
			
			`	"I hope the Remnant treated you well," one of the elders says.`
			`	"They were an interesting group. Very reclusive, and not willing to share much of their people, but they were more than willing to help after we provided them with a copy of our historical astronomical data."`
				goto next
			
			label coalition
			`	"I hope the Coalition treated you well," one of the elders says.`
			`	"They were an interesting group. Very enthusiatic about meeting new people, although very touchy on the subject of the Quarg."`
			
			label next
			`	Yashili then hands the copy of the data to Osen. "You'll be needing this," she says.`
			`	"And I'll certainly love it," Osen responds. "The spaceport workers have already sent the cargo en route to my shipyard. I'll begin working on implementing it into the Pond Strider immediately."`
			choice
				`	"Pond Strider?"`
				`	"I hope you have fun with that."`
					goto fun
			
			`	"Yes. That is the name that we settled on for the ship, and its drones will be named the Flea."`
			`	"I'm getting itchy just thinking about it," one of the elders jokes.`
				goto end
			
			label fun
			`	"It's hard not to have fun when you love doing your job."`
			
			label end
			`	Osen is about to run off, but one of the elders stops him. "Can you give us any estimate on how long it will take to make use of this data?"`
			`	"Oh, yes," Osen says. "It may take us a few months to get everything working. A single month at the least if we are lucky."`
			`	"This is good to know. The sooner we have these ships function, the better."`
			`	Osen once again gets ready to run off, but this time stops himself and turns to you. "Thank you Captain. Without this information, it could have taken me years to finish this project." You nod in response, and Osen finally runs off to his shipyard.`
			`	"I would like to thank you as well," Yashili says. "It has been some time since I have had the chance to leave our space. It is always exciting to go to new places and meet new people." Yashili bows to you, and you return a bow of your own.`
			`	"And we also need to express our gratitude," one of the elders says. "It is good to have you as a friend of the Hai. We shall keep you no longer, though. May you stay safe on your adventures."`
				decline



mission "Strider notification"
	invisible
	landing
	source
		government "Hai"
	to offer
		has "event: pond strider mass production"
	on offer
		conversation
			scene `thumbnail/hai pond strider`
			`Upon landing on <planet>, you receive a message from Osen. "Hello Captain <last>! I hope this message finds you well. I would like to once again thank you for your help on the Pond Strider, and would like to inform you that we have finished implementing the hull repair technology that you have provided us into the Pond Strider design and have now begun producing the ship on a mass scale. You'll also be interested to find that we have developed new weaponry for the Pond Strider's drone, the Flea. I won't spoil the surprise for you though. Check the shipyard on Hai-home the next time you stop by to take a look at it."`
				decline
